diff options
-rw-r--r-- | cmake/QtPlatformAndroid.cmake | 28 | ||||
-rw-r--r-- | src/corelib/Qt6AndroidMacros.cmake | 23 |
2 files changed, 25 insertions, 26 deletions
diff --git a/cmake/QtPlatformAndroid.cmake b/cmake/QtPlatformAndroid.cmake index 62fc7fe8cf..fbd0c9f8d5 100644 --- a/cmake/QtPlatformAndroid.cmake +++ b/cmake/QtPlatformAndroid.cmake @@ -1,22 +1,15 @@ # # Self contained Platform Settings for Android # -# Note: This file is used both by the internal and public builds. +# Note: This file is used by the internal builds. # # -# Public variables: +# Variables: # QT_ANDROID_JAR # Location of the adroid sdk jar for java code -# QT_ANDROID_APIVERSION +# QT_ANDROID_API_VERSION # Android API version -# QT_ANDROID_SDK_BUILD_TOOLS_VERSION -# Detected Android sdk build tools version -# -# Public functions: -# -# qt_android_generate_deployment_settings() -# Generate the deployment settings json file for a cmake target. # if (NOT DEFINED ANDROID_SDK_ROOT) @@ -72,21 +65,6 @@ include(UseJava) # Find JDK 8.0 find_package(Java 1.8 COMPONENTS Development REQUIRED) -# Locate newest android sdk build tools -if (NOT QT_ANDROID_SDK_BUILD_TOOLS_VERSION) - 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_VERSION ${android_build_tools_latest}) -endif() - # Ensure we are using the shared version of libc++ if(NOT ANDROID_STL STREQUAL c++_shared) message(FATAL_ERROR "The Qt libraries on Android only supports the shared library configuration of stl. Please use -DANDROID_STL=\"c++_shared\" as configuration argument.") 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) |