Skip to content

Commit 0839ad7

Browse files
committed
dsp(build): honor single-arch CMAKE_OSX_ARCHITECTURES for SIMD selection
1 parent 832cfd9 commit 0839ad7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/dsp/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ target_sources(dsd-neo_dsp PRIVATE
2222
sync_calibration.c
2323
)
2424

25+
set(_dsd_neo_dsp_target_arch "${CMAKE_SYSTEM_PROCESSOR}")
26+
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
27+
list(LENGTH CMAKE_OSX_ARCHITECTURES _dsd_neo_osx_arch_count)
28+
if(_dsd_neo_osx_arch_count EQUAL 1)
29+
list(GET CMAKE_OSX_ARCHITECTURES 0 _dsd_neo_dsp_target_arch)
30+
endif()
31+
endif()
32+
2533
# x86-64 SIMD sources with arch-specific flags
26-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64")
34+
if(_dsd_neo_dsp_target_arch MATCHES "x86_64|AMD64|amd64")
2735
target_sources(dsd-neo_dsp PRIVATE simd_fir_sse2.cpp)
2836
target_sources(dsd-neo_dsp PRIVATE simd_widen_sse2.cpp)
2937
# Explicit SSE2 flag for clarity and cross-compilation safety
@@ -56,7 +64,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64")
5664
endif()
5765

5866
# ARM64 NEON (always available on AArch64)
59-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
67+
if(_dsd_neo_dsp_target_arch MATCHES "aarch64|arm64|ARM64")
6068
target_sources(dsd-neo_dsp PRIVATE simd_fir_neon.cpp)
6169
target_sources(dsd-neo_dsp PRIVATE simd_widen_neon.cpp)
6270
endif()

0 commit comments

Comments
 (0)