aboutsummaryrefslogtreecommitdiff
path: root/toolchain/Android.cmake
diff options
context:
space:
mode:
authorVolker Krause <vkrause@kde.org>2020-03-03 19:46:12 +0100
committerVolker Krause <vkrause@kde.org>2020-03-03 19:47:00 +0100
commitc9ebd3917e59192a9b8655c3dd150064a4ae98b4 (patch)
tree328ae5f1a836f0bce83d445d8dfe3cc23fb39459 /toolchain/Android.cmake
parent040504da64aa5c623d2ab5907f8d36003ba57e9f (diff)
downloadextra-cmake-modules-c9ebd3917e59192a9b8655c3dd150064a4ae98b4.tar.gz
extra-cmake-modules-c9ebd3917e59192a9b8655c3dd150064a4ae98b4.tar.bz2
Support NDK r20 and Qt 5.14
Summary: This changes from using the toolchain file provided by CMake to using the one provided by the NDK, as even recent CMake can't build successfully with r20. However this is a rather invasive change, the interface and variable names differ. The Qt 5.14 changes are less risky, as most of this is parallel to the support for older versions. Test Plan: Local builds with 5.14/r20, 5.14/r18 work, the Docker SDK isn't tested yet, and there's some remaining issues with 5.13 and older NDKs I don't fully understand yet. The resulting apks with 5.14 install, and work for QQC2 content, but fail to start Kirigami apps. Reviewers: apol Reviewed By: apol Subscribers: flherne, apol, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Maniphest Tasks: T12520 Differential Revision: https://phabricator.kde.org/D26749
Diffstat (limited to 'toolchain/Android.cmake')
-rw-r--r--toolchain/Android.cmake20
1 files changed, 13 insertions, 7 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake
index 5c27db29..63b40e70 100644
--- a/toolchain/Android.cmake
+++ b/toolchain/Android.cmake
@@ -167,18 +167,24 @@ if (NOT CMAKE_ANDROID_STL_TYPE)
set(CMAKE_ANDROID_STL_TYPE c++_shared)
endif()
-include(${CMAKE_ROOT}/Modules/Platform/Android-Clang.cmake REQUIRED)
-include(${CMAKE_ROOT}/Modules/Platform/Android-Initialize.cmake REQUIRED)
+# let the Android NDK toolchain file do the actual work
+set(ANDROID_PLATFORM "android-${CMAKE_ANDROID_API}")
+set(ANDROID_STL ${CMAKE_ANDROID_STL_TYPE})
+include(${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake REQUIRED)
+
+# these aren't set yet at this point by the Android toolchain, but without
+# those the find_package() call in ECMAndroidDeployQt will fail
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+
+# determine STL architecture, which is using a different format than ANDROID_ARCH_ABI
+string(REGEX REPLACE "-(clang)?([0-9].[0-9])?$" "" ECM_ANDROID_STL_ARCH ${ANDROID_TOOLCHAIN_NAME})
if (NOT DEFINED ECM_ADDITIONAL_FIND_ROOT_PATH)
SET(ECM_ADDITIONAL_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
endif()
-SET(CMAKE_FIND_ROOT_PATH ${CMAKE_ANDROID_NDK} ${CMAKE_ANDROID_NDK}/sysroot ${CMAKE_SYSROOT} ${ECM_ADDITIONAL_FIND_ROOT_PATH})
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+LIST(APPEND CMAKE_FIND_ROOT_PATH ${ECM_ADDITIONAL_FIND_ROOT_PATH})
#we want executables to be shared libraries, hooks will invoke the exported cmake function
set(CMAKE_CXX_LINK_EXECUTABLE