This addresses a shortcoming observed with the Windows FFTW package on conda-forge, which uses CMake to build with MSVC. Those packages are built with SSE2 and AVX instructions enabled, and contrary to the desired behavior, users with processors that don't have AVX support have been reporting that the library fails to load. I finally tracked this down to the fact that when using CMake the entire library is built with the enabled SIMD flags, rather than just the specific SIMD files as with configure/make. Thus the compiler was inserting SIMD instructions elsewhere in the library, not gated by the check for whether the runtime CPU supported them.
This PR modifies the CMake build so that it applies the SIMD flags only on the appropriate source files as with configure/make. Patching this fix into the conda-forge package allowed me to use the library on a machine without AVX support while the package still had it enabled.
This addresses a shortcoming observed with the Windows FFTW package on conda-forge, which uses CMake to build with MSVC. Those packages are built with SSE2 and AVX instructions enabled, and contrary to the desired behavior, users with processors that don't have AVX support have been reporting that the library fails to load. I finally tracked this down to the fact that when using CMake the entire library is built with the enabled SIMD flags, rather than just the specific SIMD files as with configure/make. Thus the compiler was inserting SIMD instructions elsewhere in the library, not gated by the check for whether the runtime CPU supported them.
This PR modifies the CMake build so that it applies the SIMD flags only on the appropriate source files as with configure/make. Patching this fix into the conda-forge package allowed me to use the library on a machine without AVX support while the package still had it enabled.