This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 04e0fa3307f2376d3f6b8f6dd3c60157a4ef81b2 (commit) via c5892e484e21f49abf2afd138dddd6720bf91adc (commit) from 24703b11b41e2e95d566ee911f0f87bdb47d4883 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04e0fa3307f2376d3f6b8f6dd3c60157a4ef81b2 commit 04e0fa3307f2376d3f6b8f6dd3c60157a4ef81b2 Merge: 24703b11b4 c5892e484e Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Oct 22 12:57:34 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Oct 22 08:57:44 2019 -0400 Merge topic 'android-native' c5892e484e Android: add support for native compilation, such as with the Termux app Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3917 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5892e484e21f49abf2afd138dddd6720bf91adc commit c5892e484e21f49abf2afd138dddd6720bf91adc Author: Butta <g...@butta.fastem.com> AuthorDate: Tue Oct 15 13:24:02 2019 +0530 Commit: Butta <g...@butta.fastem.com> CommitDate: Tue Oct 15 21:13:51 2019 +0530 Android: add support for native compilation, such as with the Termux app The CMake support for Android assumes cross-compilation using the NDK, so stub out that Android NDK support and use the Linux support that's already invoked. Set CMAKE_HOST_SYSTEM_NAME to "Android", rather than "Linux". Issue: #19840 diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index dc208c600d..f3ec4da2d9 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -43,7 +43,7 @@ if(CMAKE_HOST_UNIX) else() exec_program(${CMAKE_UNAME} ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) endif() - if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$") + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$|Android") exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake index 847178fbd4..759448b8ec 100644 --- a/Modules/Platform/Android-Clang.cmake +++ b/Modules/Platform/Android-Clang.cmake @@ -24,6 +24,14 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1) return() endif() +# Natively compiling on an Android host doesn't use the NDK cross-compilation +# tools. +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + macro(__android_compiler_clang lang) + endmacro() + return() +endif() + include(Platform/Android-Common) # The NDK toolchain configuration files at: diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index e7c1b48a94..2225897fab 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -18,6 +18,12 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1) return() endif() +# Natively compiling on an Android host doesn't use the NDK cross-compilation +# tools. +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + return() +endif() + cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake index a5d282085e..b90dd7a569 100644 --- a/Modules/Platform/Android-Initialize.cmake +++ b/Modules/Platform/Android-Initialize.cmake @@ -24,6 +24,12 @@ if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) return() endif() +# Natively compiling on an Android host doesn't use the NDK cross-compilation +# tools. +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + return() +endif() + if(NOT CMAKE_SYSROOT) if(CMAKE_ANDROID_NDK) set(CMAKE_SYSROOT "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}") diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index f08f84176d..8ffa1b2d3b 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -2,6 +2,11 @@ include(Platform/Linux) set(ANDROID 1) +# Natively compiling on an Android host doesn't need these flags to be reset. +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + return() +endif() + # Conventionally Android does not use versioned soname # But in modern versions it is acceptable if(NOT DEFINED CMAKE_PLATFORM_NO_VERSIONED_SONAME) diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake index 5c6b97b8bc..f9c2d8968a 100644 --- a/Modules/Platform/Android/Determine-Compiler.cmake +++ b/Modules/Platform/Android/Determine-Compiler.cmake @@ -31,6 +31,16 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(_ANDROID_HOST_EXT "") elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") set(_ANDROID_HOST_EXT ".exe") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + # Natively compiling on an Android host doesn't use the NDK cross-compilation + # tools. + macro(__android_determine_compiler lang) + # Do nothing + endmacro() + if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) + endif() + return() else() message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.") endif() diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 645907c21e..832e74ec7f 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -315,10 +315,14 @@ void cmStateSnapshot::SetDefaultDefinitions() this->SetDefinition("UNIX", "1"); this->SetDefinition("CMAKE_HOST_UNIX", "1"); +# if defined(__ANDROID__) + this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", "Android"); +# else struct utsname uts_name; if (uname(&uts_name) >= 0) { this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", uts_name.sysname); } +# endif #endif #if defined(__CYGWIN__) std::string legacy; ----------------------------------------------------------------------- Summary of changes: Modules/CMakeDetermineSystem.cmake | 2 +- Modules/Platform/Android-Clang.cmake | 8 ++++++++ Modules/Platform/Android-Determine.cmake | 6 ++++++ Modules/Platform/Android-Initialize.cmake | 6 ++++++ Modules/Platform/Android.cmake | 5 +++++ Modules/Platform/Android/Determine-Compiler.cmake | 10 ++++++++++ Source/cmStateSnapshot.cxx | 4 ++++ 7 files changed, 40 insertions(+), 1 deletion(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits