I'm working in a general CMake script that provides a grateful fallback strategy regarding activation of vectorization capabilities while compiling a project with Eigen.
Using Eigen 3.4 with C++17 standard and compiled with an updated compiler (ex. gcc > 7), there is no code requirements for the developer to comply regarding static objects alignment. No more EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro and explicit alignment in STL containers (and we cheered hard in our lab for this!).
But we have a diverse landscape of projects with diverse compilation setups. We would like to write our code without worrying about alignment while a CMake script detects the architecture+compilation capabilities and deactivates Eigen's unsafe vectorization features for the architecture (even when this means breaking abi-compatibility).
Is there a way to retrieve the architecture max alignment size at CMake level, to properly set the EIGEN_MAX_STATIC_ALIGN_BYTES directive??
Maybe a bash script that retrieves the max_align_t? https://en.cppreference.com/w/cpp/types/max_align_t