diff options
author | Haibo Huang <hhb@google.com> | 2020-11-10 01:08:56 (GMT) |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-11-10 19:05:36 (GMT) |
commit | a585b75df98c9cd995ed1f50f76887378bac4978 (patch) | |
tree | 0ab85e21574e661c9ac6e4f04ea429cf300a8140 | |
parent | 7a04f45722b2cbe51e1586cd84d2c5ad90e759ed (diff) | |
download | CMake-a585b75df98c9cd995ed1f50f76887378bac4978.zip CMake-a585b75df98c9cd995ed1f50f76887378bac4978.tar.gz CMake-a585b75df98c9cd995ed1f50f76887378bac4978.tar.bz2 |
Android: Use NDK_KNOWN_DEVICE_ABI{32,64}S instead of NDK_DEFAULT_ABIS
Revise logic from commit 1ab574a0f4 (Android: Add support for NDK r22,
2020-10-07, v3.19.0-rc1~18^2) that loads ABI tables from the NDK.
`NDK_DEFAULT_ABIS` means the abis to build by default.
Use `NDK_KNOWN_DEVICE_ABI{32,64}S` instead.
In practise they have never been different. Fix to make it more precise.
-rw-r--r-- | Modules/Platform/Android-Determine.cmake | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index f7d8d13..bc66ba1 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -202,8 +202,13 @@ if(NOT CMAKE_ANDROID_NDK AND NOT CMAKE_ANDROID_STANDALONE_TOOLCHAIN) endif() if(CMAKE_ANDROID_NDK) - # NDK >= 18 has abis.cmake and platforms.cmake. + # NDK >= 18 has platforms.cmake. It provides: + # NDK_MIN_PLATFORM_LEVEL + # NDK_MAX_PLATFORM_LEVEL include("${CMAKE_ANDROID_NDK}/build/cmake/platforms.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_PLATFORMS) + # NDK >= 18 has abis.cmake. It provides: + # NDK_KNOWN_DEVICE_ABI32S + # NDK_KNOWN_DEVICE_ABI64S include("${CMAKE_ANDROID_NDK}/build/cmake/abis.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_ABIS) endif() @@ -241,6 +246,10 @@ else() set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED "") endif() +if(_INCLUDED_ABIS) + set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S}) +endif() + # https://developer.android.com/ndk/guides/abis.html set(_ANDROID_ABI_arm64-v8a_PROC "aarch64") @@ -307,7 +316,7 @@ if(NOT CMAKE_ANDROID_ARCH_ABI) elseif(_INCLUDED_ABIS) # Default to the oldest ARM ABI. foreach(abi armeabi armeabi-v7a arm64-v8a) - if("${abi}" IN_LIST NDK_DEFAULT_ABIS) + if("${abi}" IN_LIST _ANDROID_KNOWN_ABIS) set(CMAKE_ANDROID_ARCH_ABI "${abi}") break() endif() @@ -353,10 +362,10 @@ if(NOT CMAKE_ANDROID_ARCH_ABI) endif() endif() endif() -if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST NDK_DEFAULT_ABIS) +if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST _ANDROID_KNOWN_ABIS) message(FATAL_ERROR "Android: ABI '${CMAKE_ANDROID_ARCH_ABI}' is not supported by the NDK.\n" - "Supported ABIS: ${NDK_DEFAULT_ABIS}." + "Supported ABIS: ${_ANDROID_KNOWN_ABIS}." ) endif() set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}") |