Skip to content

Commit a169e10

Browse files
Fix macOS cross-architecture build on arm64 when target arch is x86_64 (#582)
1 parent ce3dfa8 commit a169e10

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ if(CCACHE_PROGRAM)
6666
endif(CCACHE_PROGRAM)
6767

6868
MESSAGE(STATUS "ARCHITECTURE: ${CMAKE_SYSTEM_PROCESSOR}")
69+
set(PULSAR_TARGET_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
70+
if (APPLE AND CMAKE_OSX_ARCHITECTURES)
71+
list(LENGTH CMAKE_OSX_ARCHITECTURES PULSAR_OSX_ARCH_COUNT)
72+
if (PULSAR_OSX_ARCH_COUNT EQUAL 1)
73+
set(PULSAR_TARGET_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
74+
endif ()
75+
endif ()
76+
MESSAGE(STATUS "TARGET_ARCHITECTURE: ${PULSAR_TARGET_PROCESSOR}")
6977

7078
option(BUILD_DYNAMIC_LIB "Build dynamic lib" ON)
7179
MESSAGE(STATUS "BUILD_DYNAMIC_LIB: " ${BUILD_DYNAMIC_LIB})
@@ -99,7 +107,7 @@ else() # GCC or Clang are mostly compatible:
99107
add_compile_options(-Wall -Wformat-security -Wvla -Werror)
100108
# Turn off certain warnings that are too much pain for too little gain:
101109
add_compile_options(-Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp)
102-
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
110+
if (PULSAR_TARGET_PROCESSOR STREQUAL "x86_64")
103111
add_compile_options(-msse4.2 -mpclmul)
104112
endif()
105113
# Options unique to Clang or GCC:

0 commit comments

Comments
 (0)