Skip to content

Commit 832d4ee

Browse files
committed
fix: only use intrinsics SIMD on x86_64 and aarch64 by default
1 parent 5aa90fd commit 832d4ee

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

CMakeLists.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,17 @@ option(LIBUNICODE_TOOLS "libunicode: Builds CLI tools [default: ${MASTER_PROJECT
4848
option(LIBUNICODE_BUILD_STATIC "libunicode: provide static library instead of dynamic [default: ${LIBUNICODE_BUILD_STATIC_DEFAULT}]" ${LIBUNICODE_BUILD_STATIC_DEFAULT})
4949
option(LIBUNICODE_TABLEGEN_FASTBUILD "libunicode: Use fast table generation (takes more memory in final tables) [default: OFF]" OFF)
5050

51+
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_PROCESSOR_LOWER)
52+
5153
if(NOT LIBUNICODE_SIMD_IMPLEMENTATION)
52-
set(LIBUNICODE_SIMD_IMPLEMENTATION "intrinsics" CACHE STRING "libunicode: SIMD implementation to use" FORCE)
54+
if((SYSTEM_PROCESSOR_LOWER STREQUAL "x86_64")
55+
OR (SYSTEM_PROCESSOR_LOWER STREQUAL "aarch64")
56+
OR (SYSTEM_PROCESSOR_LOWER STREQUAL "amd64")
57+
OR (SYSTEM_PROCESSOR_LOWER STREQUAL "arm64"))
58+
set(LIBUNICODE_SIMD_IMPLEMENTATION "intrinsics" CACHE STRING "libunicode: SIMD implementation to use" FORCE)
59+
else()
60+
set(LIBUNICODE_SIMD_IMPLEMENTATION "std" CACHE STRING "libunicode: SIMD implementation to use" FORCE)
61+
endif()
5362
set_property(CACHE LIBUNICODE_SIMD_IMPLEMENTATION PROPERTY STRINGS "std" "intrinsics" "none")
5463
endif()
5564

0 commit comments

Comments
 (0)