Skip to content

Commit

Permalink
Fix macOS build with Xcode 15.4 and -arch arm64, see also 8a384af
Browse files Browse the repository at this point in the history
Fixes rurban#284 by disabling PMP_Multilinear not only on aarch64, but also
on arm64. Those are the same things under different labels.
  • Loading branch information
darkk committed Sep 2, 2024
1 parent 04c435d commit 4cd75f8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ elseif ((CMAKE_SYSTEM_PROCESSOR STREQUAL "arm")
add_definitions(-DHAVE_NEON)
endif()

if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") # GNU and others
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")) # macOS
set(SYSTEM_PROCESSOR_IS_AARCH64 TRUE)
else()
set(SYSTEM_PROCESSOR_IS_AARCH64 FALSE)
endif()

# TODO: rather parse `$CC -march=native -dM -E - <<< ''` [GH #10]
if(NOT CMAKE_CROSSCOMPILING)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand Down Expand Up @@ -324,7 +331,7 @@ else(AVX512VL_TRUE)
endif(AVX512VL_TRUE)

if(CMAKE_CROSSCOMPILING)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
if(SYSTEM_PROCESSOR_IS_AARCH64)
set(SSE2_FOUND true)
set(SSE42_FOUND true)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
Expand Down Expand Up @@ -470,13 +477,13 @@ if(SSE42_FOUND)
list(APPEND X86_64ONLY_SRC metrohash/metrohash64crc.cpp
metrohash/metrohash128crc.cpp)
endif()
if(NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") AND NOT MSVC)
if(NOT SYSTEM_PROCESSOR_IS_AARCH64 AND NOT MSVC)
list(APPEND X86_64ONLY_SRC crc32_hw1.c)
endif()
else()
message(STATUS "32bit only: CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}")
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
if(SYSTEM_PROCESSOR_IS_AARCH64)
set(SIPHASH_SRC siphash.c)
else()
set(SIPHASH_SRC siphash_ssse3.c)
Expand Down Expand Up @@ -574,7 +581,7 @@ endif()
set(BLAKE3_SRC blake3/blake3.c blake3/blake3_dispatch.c
blake3/blake3_portable.c)
if(SSE42_FOUND)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
if(SYSTEM_PROCESSOR_IS_AARCH64)
set(BLAKE3_SRC ${BLAKE3_SRC} blake3/blake3_neon.c)
else()
set(BLAKE3_SRC ${BLAKE3_SRC} blake3/blake3_sse41.c)
Expand Down Expand Up @@ -618,7 +625,7 @@ if(CMAKE_CROSSCOMPILING)
unset(PMPML_SRC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCROSSCOMPILING")
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
if(SYSTEM_PROCESSOR_IS_AARCH64)
#HAVE_SSE42
unset(PMPML_SRC)
endif()
Expand Down

0 comments on commit 4cd75f8

Please sign in to comment.