diff options
author | Brad King <brad.king@kitware.com> | 2019-07-26 11:04:41 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-07-26 14:17:07 -0400 |
commit | 4e6c58d937564c6692a86a958ca75a0f1def582d (patch) | |
tree | 914d97e90164791bcc761c4ac002981ddefb5d2a /Modules/Platform/Android-Determine.cmake | |
parent | 8ce189720ee8daafed4848ee9eb970f9e0546578 (diff) | |
download | cmake-4e6c58d937564c6692a86a958ca75a0f1def582d.tar.gz |
Android: Select NDK host tag while determining system
The host tag is tied to the host platform and does not depend on any
specific language or compiler.
Diffstat (limited to 'Modules/Platform/Android-Determine.cmake')
-rw-r--r-- | Modules/Platform/Android-Determine.cmake | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index bb42eedde4..bc9c364db9 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -198,6 +198,33 @@ if(NOT CMAKE_SYSTEM_VERSION MATCHES "^[0-9]+$") message(FATAL_ERROR "Android: The API specified by CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}' is not an integer.") endif() +if(CMAKE_ANDROID_NDK) + # Identify the host platform. + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "darwin-x86_64") + else() + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "darwin-x86") + endif() + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "linux-x86_64") + else() + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "linux-x86") + endif() + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "windows-x86_64") + else() + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "windows") + endif() + else() + message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.") + endif() +else() + set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "") +endif() + # https://developer.android.com/ndk/guides/abis.html set(_ANDROID_ABI_arm64-v8a_PROC "aarch64") @@ -342,6 +369,7 @@ if(CMAKE_ANDROID_NDK) string(APPEND CMAKE_SYSTEM_CUSTOM_CODE "set(CMAKE_ANDROID_ARCH_HEADER_TRIPLE \"${CMAKE_ANDROID_ARCH_HEADER_TRIPLE}\")\n" "set(CMAKE_ANDROID_NDK_DEPRECATED_HEADERS \"${CMAKE_ANDROID_NDK_DEPRECATED_HEADERS}\")\n" + "set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG \"${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}\")\n" ) endif() |