diff options
author | Gabriel Souza Franco <gabrielfrancosouza@gmail.com> | 2020-09-11 09:49:50 -0300 |
---|---|---|
committer | Aleix Pol Gonzalez <aleixpol@kde.org> | 2020-09-16 14:53:29 +0000 |
commit | 3672943cf1128470cae08c70f2d5c97887cd3125 (patch) | |
tree | c1126fee0e5ea4046cc6b6e89b04f51539d35fda /toolchain/Android.cmake | |
parent | 4a3659f1d474b8a94bd4d28e1ab919d7d4e6d28c (diff) | |
download | extra-cmake-modules-3672943cf1128470cae08c70f2d5c97887cd3125.tar.gz extra-cmake-modules-3672943cf1128470cae08c70f2d5c97887cd3125.tar.bz2 |
Store Android {min,target,compile}Sdk in variables
Also pass along these values to androiddeployqt
Diffstat (limited to 'toolchain/Android.cmake')
-rw-r--r-- | toolchain/Android.cmake | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 3e6a877c..e3ace15a 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -45,8 +45,12 @@ # ``ANDROID_ABI`` # The ABI to use. See the ``sources/cxx-stl/gnu-libstdc++/*/libs`` # directories in the NDK. Default: ``armeabi-v7a``. +# ``ANDROID_SDK_COMPILE_API`` +# The platform API level to compile against. May be different from the NDK +# target. Default: newest installed version (e.g. android-30). # ``ANDROID_SDK_BUILD_TOOLS_REVISION`` -# The build tools version to use. Default: ``21.1.1``. +# The build tools version to use. +# Default: newest installed version (e.g. ``30.0.2``). # ``ANDROID_EXTRA_LIBS`` # The ";"-separated list of full paths to libs to include in resulting APK. # @@ -137,9 +141,16 @@ set_deprecated_variable(CMAKE_ANDROID_ARCH_ABI ANDROID_ABI "$ENV{ANDROID_ARCH_AB set(ANDROID_SDK_ROOT "$ENV{ANDROID_SDK_ROOT}" CACHE PATH "Android SDK path") +file(GLOB platforms LIST_DIRECTORIES TRUE RELATIVE ${ANDROID_SDK_ROOT}/platforms ${ANDROID_SDK_ROOT}/platforms/*) +list(GET platforms -1 _default_platform) +set(ANDROID_SDK_COMPILE_API "${_default_platform}" CACHE STRING "Android API Level") +if(ANDROID_SDK_COMPILE_API MATCHES "^android-([0-9]+)$") + set(ANDROID_SDK_COMPILE_API ${CMAKE_MATCH_1}) +endif() + file(GLOB build-tools LIST_DIRECTORIES TRUE RELATIVE ${ANDROID_SDK_ROOT}/build-tools ${ANDROID_SDK_ROOT}/build-tools/*) -list(GET build-tools 0 _default_sdk) -set(ANDROID_SDK_BUILD_TOOLS_REVISION "${_default_sdk}" CACHE STRING "Android API Level") +list(GET build-tools -1 _default_sdk) +set(ANDROID_SDK_BUILD_TOOLS_REVISION "${_default_sdk}" CACHE STRING "Android Build Tools version") set(CMAKE_SYSTEM_VERSION ${CMAKE_ANDROID_API}) set(CMAKE_SYSTEM_NAME Android) |