diff options
author | Martin Storsjö <martin@martin.st> | 2024-04-11 11:24:02 +0300 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-04-11 08:56:46 +0000 |
commit | 38fa3ce2c9e35e7bd2d36aa5de5f58b5307bf470 (patch) | |
tree | 21f50d9b595b69e93d642eb07fa62af7b7851d72 | |
parent | 3af6cafe8d3753536a1f0e9e831fb9fd4563e10b (diff) | |
download | libyuv-38fa3ce2c9e35e7bd2d36aa5de5f58b5307bf470.tar.gz |
CMake: Improve the checks for CMAKE_SYSTEM_PROCESSOR
CMAKE_SYSTEM_PROCESSOR doesn't strictly have the values "arm" or
"aarch64", it can have more varied spellings. When cross compiling,
the value is specified by the user, but when doing native compilation,
the variable gets its value from CMAKE_HOST_SYSTEM_PROCESSOR. This
variable is defined to have the value of $(uname -m) on many Unixes.
This can give values like "armv7l" on some hosts, and "arm64" on
macOS.
Thus, when checking for aarch64, also check for the spelling "arm64".
And when checking for arm, check for any string that starts with
"arm", except for "arm64".
Change-Id: I99695ee2f3439098c897ae1408605781cd0db9fd
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5444427
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d6739a71..7dc0c974 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ SET(ly_lib_parts $<TARGET_OBJECTS:${ly_lib_name}_common_objects>) if(NOT MSVC) STRING(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" arch_lowercase) - if(arch_lowercase STREQUAL "arm") + if(arch_lowercase MATCHES "^arm" AND NOT arch_lowercase STREQUAL "arm64") # Enable Arm Neon kernels. ADD_DEFINITIONS(-DLIBYUV_NEON=1) ADD_LIBRARY(${ly_lib_name}_neon OBJECT @@ -95,7 +95,7 @@ if(NOT MSVC) LIST(APPEND ly_lib_parts $<TARGET_OBJECTS:${ly_lib_name}_neon>) endif() - if(arch_lowercase STREQUAL "aarch64") + if(arch_lowercase STREQUAL "aarch64" OR arch_lowercase STREQUAL "arm64") # Enable AArch64 Neon dot-product and i8mm kernels. ADD_LIBRARY(${ly_lib_name}_neon64 OBJECT ${ly_src_dir}/compare_neon64.cc |