Browse Source

cmake: switch CMAKE_HOST_SYSTEM_NAME to Android, which is used to set

CMAKE_SYSTEM_NAME by default, then disable CMake's built-in NDK support
when CMAKE_SYSTEM_NAME is set to Android.
android-5
Butta 5 years ago
committed by Fredrik Fornwall
parent
commit
7e93c153ce
  1. 13
      packages/cmake/Modules-CMakeDetermineSystem.cmake.patch
  2. 17
      packages/cmake/Modules-Platform-Android-Clang.cmake.patch
  3. 19
      packages/cmake/Modules-Platform-Android-Determine-Compiler.cmake.patch
  4. 15
      packages/cmake/Modules-Platform-Android-Determine.cmake.patch
  5. 15
      packages/cmake/Modules-Platform-Android-Initialize.cmake.patch
  6. 15
      packages/cmake/Modules-Platform-Android.cmake.patch
  7. 20
      packages/cmake/Source-cmStateSnapshot.cxx.patch
  8. 1
      packages/cmake/build.sh

13
packages/cmake/Modules-CMakeDetermineSystem.cmake.patch

@ -0,0 +1,13 @@
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index dc208c600..f3ec4da2d 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

17
packages/cmake/Modules-Platform-Android-Clang.cmake.patch

@ -0,0 +1,17 @@
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
index 9ed1e01f9..6443512ee 100644
--- a/Modules/Platform/Android-Clang.cmake
+++ b/Modules/Platform/Android-Clang.cmake
@@ -24,6 +24,12 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
+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:

19
packages/cmake/Modules-Platform-Android-Determine-Compiler.cmake.patch

@ -0,0 +1,19 @@
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
index a03ebcc29..34d527741 100644
--- a/Modules/Platform/Android/Determine-Compiler.cmake
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -31,6 +31,14 @@ 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")
+ 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()

15
packages/cmake/Modules-Platform-Android-Determine.cmake.patch

@ -0,0 +1,15 @@
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index bb42eedde..0e8229d5e 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -18,6 +18,10 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android")
+ return()
+endif()
+
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST

15
packages/cmake/Modules-Platform-Android-Initialize.cmake.patch

@ -0,0 +1,15 @@
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
index a434f90ea..407ed3358 100644
--- a/Modules/Platform/Android-Initialize.cmake
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -17,6 +17,10 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
+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}")

15
packages/cmake/Modules-Platform-Android.cmake.patch

@ -0,0 +1,15 @@
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index f08f84176..9e719df39 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -2,6 +2,10 @@ include(Platform/Linux)
set(ANDROID 1)
+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)

20
packages/cmake/Source-cmStateSnapshot.cxx.patch

@ -0,0 +1,20 @@
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 63bec710b..19286c50e 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -316,11 +316,15 @@ 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;
if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) &&

1
packages/cmake/build.sh

@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://cmake.org/
TERMUX_PKG_DESCRIPTION="Family of tools designed to build, test and package software"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_VERSION=3.15.3
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.cmake.org/files/v${TERMUX_PKG_VERSION:0:4}/cmake-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=13958243a01365b05652fa01b21d40fa834f70a9e30efa69c02604e64f58b8f5
TERMUX_PKG_DEPENDS="libarchive, libc++, libcurl, libexpat, jsoncpp, libuv, rhash, make, clang, zlib"

Loading…
Cancel
Save