diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-10-05 14:49:39 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-10-06 06:31:18 +0200 |
commit | 1f52f45836351d4f79b954ffdb3bba018065eeaf (patch) | |
tree | 221cc0c04ac6a84743264572d6870b69d46bdc8b /cmake/QtProcessConfigureArgs.cmake | |
parent | 260a6e86c2e7f52c9b9f0340249e88d7c56b6406 (diff) |
CMake: Implement missing Android-related configure options
Implement the last remaining Android-related configure options for the
CMake build.
Print warnings for options that have no equivalent in the CMake build.
Let -android-ndk automatically deduce the CMake toolchain file, and
error out if that fails with a hint how to fix the situation.
Task-number: QTBUG-85373
Change-Id: I8399e5334ae0f1f6634e381775a308d34f7c482b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtProcessConfigureArgs.cmake')
-rw-r--r-- | cmake/QtProcessConfigureArgs.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index e28225f323..2189f1dbd5 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -565,6 +565,39 @@ endif() translate_string_input(platform QT_QMAKE_TARGET_MKSPEC) translate_string_input(xplatform QT_QMAKE_TARGET_MKSPEC) translate_string_input(qpa_default_platform QT_QPA_DEFAULT_PLATFORM) + +translate_path_input(android-sdk ANDROID_SDK_ROOT) +if(DEFINED INPUT_android-ndk) + drop_input(android-ndk) + set(toolchain_file "${INPUT_android-ndk}/build/cmake/android.toolchain.cmake") + if(EXISTS "${toolchain_file}") + message("Using CMake toolchain file: ${toolchain_file}") + else() + qtConfAddError("The toolchain file '${toolchain_file}' does not exist. " + "This file path was deduced from the -android-ndk option. Consider specifying " + "the correct toolchain file with -- -DCMAKE_TOOLCHAIN_FILE=<path>") + endif() + push("-DCMAKE_TOOLCHAIN_FILE=${toolchain_file}") + unset(toolchain_file) +endif() +if(DEFINED INPUT_android-ndk-host) + drop_input(android-ndk-host) + qtConfAddWarning("The -android-ndk-host option is not supported with the CMake build. " + "Determining the right host platform is handled by the CMake toolchain file that is " + "located in your NDK.") +endif() +if(DEFINED INPUT_android-ndk-platform) + drop_input(android-ndk-platform) + string(REGEX REPLACE "^android-" "" INPUT_android-ndk-platform "${INPUT_android-ndk-platform}") + push("-DANDROID_NATIVE_API_LEVEL=${INPUT_android-ndk-platform}") +endif() +if(DEFINED INPUT_android-abis) + if(INPUT_android-abis MATCHES ",") + qtConfAddError("The -android-abis option cannot handle more than one ABI " + "when building with CMake.") + endif() + translate_string_input(android-abis ANDROID_ABI) +endif() translate_string_input(android-javac-source QT_ANDROID_JAVAC_SOURCE) translate_string_input(android-javac-target QT_ANDROID_JAVAC_TARGET) |