summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6AndroidMacros.cmake
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-09-28 20:19:05 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2020-09-29 19:28:12 +0300
commit7a41b928d415b69635abeff13a3a6d205386652f (patch)
treef15a3c354c00ab52f9c2327d3fda2fe89b30e04a /src/corelib/Qt6AndroidMacros.cmake
parent2271d998d42313686a81d29e1174478f727167f6 (diff)
CMake: fix sdkBuildToolsRevision not being set for user apps
Add qt6_android_get_sdk_build_tools_revision() function to get the Android SDK build tools revision, the logic is moved from QtPlatformAndroid to Qt6AndroidMacros. The update QtPlatformAndroid header comments. Task-number: QTBUG-85982 Change-Id: If3e5b46fa583f929a24794792c9d5a52beb83990 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt6AndroidMacros.cmake')
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake
index 05a094d2f8..3f02661e18 100644
--- a/src/corelib/Qt6AndroidMacros.cmake
+++ b/src/corelib/Qt6AndroidMacros.cmake
@@ -1,4 +1,24 @@
# Generate deployment tool json
+
+# Locate newest Android sdk build tools revision
+function(qt6_android_get_sdk_build_tools_revision out_var)
+ if (NOT QT_ANDROID_SDK_BUILD_TOOLS_REVISION)
+ file(GLOB android_build_tools
+ LIST_DIRECTORIES true
+ RELATIVE "${ANDROID_SDK_ROOT}/build-tools"
+ "${ANDROID_SDK_ROOT}/build-tools/*")
+ if (NOT android_build_tools)
+ message(FATAL_ERROR "Could not locate Android SDK build tools under \"${ANDROID_SDK_ROOT}/build-tools\"")
+ endif()
+ list(SORT android_build_tools)
+ list(REVERSE android_build_tools)
+ list(GET android_build_tools 0 android_build_tools_latest)
+ set(QT_ANDROID_SDK_BUILD_TOOLS_REVISION ${android_build_tools_latest})
+ endif()
+ set(${out_var} "${QT_ANDROID_SDK_BUILD_TOOLS_REVISION}" PARENT_SCOPE)
+endfunction()
+
+# Generate the deployment settings json file for a cmake target.
function(qt6_android_generate_deployment_settings target)
# Information extracted from mkspecs/features/android/android_deployment_settings.prf
if (NOT TARGET ${target})
@@ -59,8 +79,9 @@ Please recheck your build configuration.")
" \"sdk\": \"${android_sdk_root_native}\",\n")
# Android SDK Build Tools Revision
+ qt6_android_get_sdk_build_tools_revision(QT_ANDROID_SDK_BUILD_TOOLS_REVISION)
string(APPEND file_contents
- " \"sdkBuildToolsRevision\": \"${QT_ANDROID_SDK_BUILD_TOOLS_VERSION}\",\n")
+ " \"sdkBuildToolsRevision\": \"${QT_ANDROID_SDK_BUILD_TOOLS_REVISION}\",\n")
# Android NDK
file(TO_NATIVE_PATH "${ANDROID_NDK}" android_ndk_root_native)