kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.65k stars 253 forks source link

Build issue on macOS when targetting x64 from ARM mac #229

Open jcelerier opened 1 month ago

jcelerier commented 1 month ago

I'm seeing the following in my build log, when building with -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" :

-- Default CPU architecture for KFR is neon64 (set KFR_ARCH to override)
  Incorrect architecture set by KFR_ARCH: neon64

Most likely the cpu detector should handle rosetta ? Also, I wonder, how is the lib supposed to handle fat macOS binaries ?

thanks !

dancazarin commented 1 month ago

Fat binaries aren't supported at this moment because KFR requires specific compiler flags to enable SIMD and these flags are platform-specific. CMake doesn't provide a convenient way to set arch-specific flags. So CMAKE_OSX_ARCHITECTURES should be set to either x86_64 or arm64 in a single build. Note that binaries built this way can be easily merged into a fat library.