summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6AndroidMacros.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Ensure versionless wrappers do not introduce a new variable scope"Craig Scott2021-09-061-6/+6
| | | | | | | | | | | | | | This reverts commit 08180e76e6116f0ef66476ca00b2b676b3aa50da. Macros add another level of escaping that functions do not. The conversion of the versionless wrappers to macros may alter the behavior, so revert that change. Task-number: QTBUG-96219 Change-Id: Ic5dcff3081123d957888584ba1d76ae0580d9083 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit a37789e4931a85fce4fba9c9612ebb4020572d54) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Ensure versionless wrappers do not introduce a new variable scopeCraig Scott2021-08-311-6/+6
| | | | | | | | | | | | | | | Using function instead of macro prevented the wrappers from being able to pass back any variables set in the wrapped function. In some cases, these variables were being explicitly passed back to the caller, but that isn't needed if you just make each wrapper a macro. This also makes things more future-proof because any newly introduced output variables will work without having to update the wrappers. Task-number: QTBUG-96121 Change-Id: Ic4486de668694c06b47e466587b2cdcb969ea047 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 08180e76e6116f0ef66476ca00b2b676b3aa50da) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add the json option to disable the zstd based compressionAlexey Edelev2021-08-231-0/+8
| | | | | | | | | | | | | | Need to disable zstd compression if its support is not built in Qt for Android. The flag is dected when configuring user's project and is a part of the deployment settings. This partially fixes loading of android_rcc_bundle.rcc. Task-number: QTBUG-93340 Task-number: QTBUG-95969 Change-Id: I635afb3f9e182a559d53e9344e07f62788f9837d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit f037357232c2157d942ad9a104543d087f8a043b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add whitespace to Android error messageKai Köhne2021-08-051-3/+3
| | | | | | | Change-Id: I9c7729a7bef4a659b10fe69a73b30f101cbba546 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 74d0b1b1b914268700bee95b76f31b2d02b0c82a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Let androiddeployqt write a dependency fileAndreas Buhr2021-07-091-21/+40
| | | | | | | | | | | Let androiddeployqt write a dependency file so that the build system knows when to re-run it. Fixes: QTBUG-94567 Change-Id: I5985d707f257b22789013a74f0a6f7c4de6e5e88 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 857be50b2e193b92de37c3e2bb5124d24d21a253) Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix Qt tool apks not to be built as part of default all targetAlexandru Croitor2021-06-121-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | The code already checked for QT_BUILDING_QT to decide whether the 'apk' target should be part of the default 'all' target, but it only worked properly for qtbase. The 'apk' target was created before the value of QT_BUILDING_QT is set when building other repos like qttools. Postpone the decision on whether 'apk' should be part of 'all' to the first call of qt_add_executable -> qt_android_add_apk_target. At this point QT_BUILDING_QT will be defined. Achieve that by relying on an additional 'apk_all' target as an implementation detail. Amends 8b8679f73d6cfb513141cc0a9f4925a64ca19455 Fixes: QTBUG-94442 Task-number: QTBUG-94264 Change-Id: I92ff0a7eef2caad244340ab7835e77c9fb3377c0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 1d05dcb3ec677a301a5a626384b2bf8003af2663) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix global 'apk' target to actually build all apksAlexandru Croitor2021-06-081-11/+29
| | | | | | | | | | | | | | | | | | | | This means calling 'ninja apk' in a user project with multiple android applications will build all their respective apks. For user projects, make the 'apk' target part of the global 'ALL' target, so that a regular 'ninja' call implies the 'apk' target. We don't do it currently for Qt builds, because certain test executable apks fail to build. Add a QT_NO_GLOBAL_APK_TARGET_PART_OF_ALL variable to allow removing the global apk target from the 'all' target. Pick-to: 6.1 Task-number: QTBUG-94264 Change-Id: I171b9da50eb7d670176704bd26dc1c492118b434 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Add Android's prepare_apk_dir target to ALLAssam Boudjelthia2021-06-021-2/+2
| | | | | | | | | | Since Qt Creator uses androiddeployqt custom commands it still needs a step to prepare the apk dir before building it, so add this to ALL to avoid having to call it manually in creator. Pick-to: 6.1 Change-Id: I0a2816244589e9b296a326fcc1abf8c08aabfea7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix path of qmlimportscanner for AndroidKai Köhne2021-05-311-1/+1
| | | | | | | | Amends c113c88aa29c47d55dc01 Fixes: QTBUG-94077 Change-Id: If8dff3ec3750e88fcff5e6e076e0666eef2ca142 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add proper dependencies to apk targetsJoerg Bornemann2021-05-171-14/+27
| | | | | | | | | | | | | | | | | | | Before, building ${target}_make_apk always re-built the apk, instead of rebuilding the apk only when inputs changed. This patch fixes that by moving the creation code from a custom target to a custom command with proper dependencies. The androidtestrunner tool now does not check for the existence of an apk anymore and always runs the make command that is supposed to build the apk. The ${target}_prepare_apk_dir target is not needed anymore by the Qt build but is still used by Qt Creator's Android support. Add a clarifying comment. Fixes: QTBUG-93431 Change-Id: I00d65d616fef9511b03b65f879c4bc6cb92dfc30 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add QT_ANDROID_TARGET_SDK_VERSION target propertyJoerg Bornemann2021-04-261-0/+7
| | | | | | | | | | | This is the counterpart of the qmake variable ANDROID_TARGET_SDK_VERSION. Pick-to: 6.1 Task-number: QTBUG-86033 Change-Id: Idd64ee06eb94826430e6be5d9d878631db67c949 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add QT_ANDROID_MIN_SDK_VERSION target propertyJoerg Bornemann2021-04-261-0/+7
| | | | | | | | | | This is the counterpart to the qmake variable ANDROID_MIN_SDK_VERSION. Pick-to: 6.1 Task-number: QTBUG-86033 Change-Id: I4e1434a794f3a8345f9b4e045ab4366d486221af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add QT_ANDROID_VERSION_{NAME|CODE} target propertiesJoerg Bornemann2021-04-261-2/+12
| | | | | | | | | | Those are the CMake counterparts of the qmake variables ANDROID_VERSION_{NAME|CODE}. Pick-to: 6.1 Task-number: QTBUG-86033 Change-Id: I57534ff04db0c78871fe7ba81bedaf377422054b Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Move build tools to libexec instead of the bin dirJoerg Bornemann2021-02-231-1/+1
| | | | | | | | | | | | | | [ChangeLog][Build System] Tools that are called by the build system and are unlikely to be called by the user are now installed to the libexec directory. This is a step towards easier co-installability of different Qt versions. Pick-to: 6.1 Task-number: QTBUG-88791 Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: always pass QT6_INSTALL_PREFIX to androiddeployqtAssam Boudjelthia2021-02-101-5/+2
| | | | | | | | | | | | Qt CMake uses a fake_prefix as install dir when running tests instead of the main qt install path, this will throw androiddeployqt off since it expects the real qt install path which has gradle and java sources. Fixes: QTBUG-88579 Pick-to: 6.0 6.1 Change-Id: I6580470840ae14d4a4a68a95f217b30408d7ab44 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix typo in android APK generation logAlex Blasche2021-02-101-1/+1
| | | | | | Pick-to: 6.0 6.1 Change-Id: I9e593f35e1c4a51ef2cd4b08fe7e4b7c1a35a5d6 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* android: Generate deployment settings file with correct qml-import-pathsCraig Scott2021-01-061-2/+7
| | | | | | | | | | | | | | | | | The qt6_android_generate_deployment_settings() command had been creating deployment settings files with the wrong key name for qml import paths. This resulted in the QT_QML_IMPORT_PATH target property having no effect. The QT_QML_IMPORT_PATH property can also potentially hold a list, not just a single value. This change now handles the list case as well, previously qt6_android_generate_deployment_settings() was assuming it always held a single path if it was set. Fixes: QTBUG-89628 Pick-to: 6.0 Change-Id: Ibdd74ec8d130f160433a60a14a0a9f496f496a1b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Prefer canonical CMAKE_ANDROID_NDK var when writing deploy fileCraig Scott2021-01-041-1/+1
| | | | | | | | | | | | | | | | | CMAKE_ANDROID_NDK is an official variable provided by CMake. The ANDROID_NDK variable will be set by the NDK toolchain file, but we don't need to rely on that (the user could theoretically not be using the NDK's toolchain file). Using the CMake-provided variable means we don't have to explain the source of the variable in documentation for the qt6_android_generate_deployment_settings() command. We should prefer to use things provided by CMake already where it makes sense and this seems to be one such case. Task-number: QTBUG-89651 Task-number: QTBUG-88839 Pick-to: 6.0 Change-Id: Ieda54de8f5c65c36da6bb55c87a8b8fdd1d5cd7b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Use host variables instead of hardcoded directoriesAlexey Edelev2020-12-211-3/+3
| | | | | | | | | | | | | | | | | | | 'QT_HOST_PATH' indicates that we use crosscompilation toolchain to build project. In this case 'Qt6Config.cmake' loads 'Qt6HostInfoConfig.cmake' from host QT_HOST_PATH, that defines correct paths to host tools. Replace hardcoded paths for host tools by paths recorded in Qt6HostInfoConfig.cmake. Correct conditions for QT_HOST_PATH, evaluate it explicitly as string, but not as boolean expression. Fixes: QTBUG-86557 Pick-to: 6.0 Change-Id: Ib52bbd32478051d019a932dcb1f735e2d4aacfbf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: fix indentations in Qt6AndroidMacros.cmakeAssam Boudjelthia2020-12-011-11/+8
| | | | | | Pick-to: 6.0 Change-Id: I1403101fb2ab6a25ab1a2258f9a832f706b8b547 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: don't add empty QT_ANDROID_APPLICATION_ARGUMENTS to JsonAssam Boudjelthia2020-12-011-2/+4
| | | | | | Pick-to: 6.0 Change-Id: I471da3f733046aeaa8381bbdeeba3ee2775b97eb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: add CMAKE_FIND_ROOT_PATH as extraPrefixDirs for androiddeployqtAssam Boudjelthia2020-11-201-0/+11
| | | | | | | | | | | | | | | | androiddeployqt has extraPrefixDirs to provide extra prefix paths in addition to the main Qt install path, however, for some reason, it was not being used. With this, apps for Android using Conan can pass the Conan build prefix for androiddeployqt to use it as well. Task-number: QTBUG-88519 Change-Id: Iad73055ac6c03e3ffe86fca271dbda67ac29a275 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 00e726ce12431e8c3db8bc9deb8952f930a5a672) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: add --apk to androiddeployqt to copy resulting apk to build dirAssam Boudjelthia2020-11-061-0/+1
| | | | | | Task-number: QTQAINFRA-3867 Change-Id: If036aa88d8e9db3ddc9d27811ccfafa1152a9f2a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Rename some public API functionsAlexandru Croitor2020-10-161-8/+2
| | | | | | | | | | | | | | | | | | | Some of them have a different (hopefully better) name now. Some are marked as Technical Preview. Some are renamed to be internal. Marking add_qt_gui_executable as TP with the intention to un-TP it after we rename it and change its behavior as discussed in the API review meeting. Additional changes to add_qt_gui_executable and qt6_add_resources have been filed as separate tasks that will be worked on separately. See comments on PS1 for details. Task-number: QTBUG-86827 Change-Id: I56a84a1943b0902bb807310dc620eb381824e8dd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Android: unify deployment-settings.json path to unix formatAssam Boudjelthia2020-10-021-8/+8
| | | | | | | | Always use unix path formats for qmake and cmake builds. Task-number: QTBUG-87066 Change-Id: I9d54c2ca687d28e38542850e3e18b6184513a9af Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Clean up the public API a bitAlexandru Croitor2020-10-011-2/+7
| | | | | | | | | | Add some missing versionless functions. Rename some functions that are not meant to be public API, and their usages. Task-number: QTBUG-86827 Change-Id: Ifb66c04cd7598d83fe80c01a92ab2d269ebaf396 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: fix sdkBuildToolsRevision not being set for user appsAssam Boudjelthia2020-09-291-1/+22
| | | | | | | | | | | 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>
* CMake: make QT_ANDROID_DEPLOYMENT_SETTINGS_FILE consistent with qmakeAssam Boudjelthia2020-09-281-1/+1
| | | | | | | | | Make name format of QT_ANDROID_DEPLOYMENT_SETTINGS_FILE consistent with qmake, that is android-${target}-deployment-settings.json. Task-number: QTCREATORBUG-24678 Change-Id: I2bdb056cf7a82fd83aaf658f3a405a0c9ef05756 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: partially revert 00a1e5dAssam Boudjelthia2020-09-231-0/+4
| | | | | | | | | | 00a1e5da7e1aea373a7e6be1d51e1573ff167dd8 wrongfully added parts of QtPlatformAndroid.cmake which were removed in 32121e9882bc69ad72d8e08ee7c21a684db921c1. This removed the part in question again Change-Id: Ie18968e6a165f52c68f4941ced6add266985bc48 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: use bin for instead of QT6_HOST_INFO_BINDIRAssam Boudjelthia2020-09-101-3/+3
| | | | | | | | | | | ${QT6_HOST_INFO_BINDIR} is returning an empty string making the tools paths unusable, and android apps building fails. Partially revert 09ac1bdfc5d2ee7a537c63e54348a8cf8d905fcf. Task-number: QTBUG-86557 Change-Id: I1522b3a4b45fbcb41894ea3bd7c714f7a79eb954 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: enable androiddeployqt to get the host's rcc binary pathAssam Boudjelthia2020-08-281-2/+11
| | | | | | | | | | Since Qt 6 CMake installs the host and target into separate directories, androiddeployqt fails to get the correct path to rcc. This change includes the host's rcc binary path in deployment-settings.json. Task-number: QTBUG-85399 Change-Id: I610bb6fea1180a119e4c0ceb75bf78c175ae430e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Split out some Android functions into a public API fileAlexandru Croitor2020-08-141-0/+256
To fix CMake Qt For Android projects to configure, we need to move some functions from a private CMake API file only, to a public one. Add Qt6AndroidMacros.cmake which will be loaded by Qt6Core package. We'll have to decide how we proceed with Qt5AndroidSupport.cmake, because that file automatically runs code when included in Qt5, and we usually don't want to do it. We'll also have to decide how to handle the define_property() calls that are still left in the private QtPlatformAndroid.cmake file. With this fix, Qt example CMake projects that use add_qt_gui_executable should now be buildable. An APK can be created with 'ninja apk'. Unfortunately Qt Creator 4.13 does not currently seem to support opening and building CMake Qt For Android projects properly. While the build succeeds after fiddling with the Kit settings, the APK deploy step fails to run (at least on my machine). So the simplest way to run the built APK is to open the android-build dir with Android Studio and launch the example application from there. Task-number: QTBUG-85399 Change-Id: I77f246331de7a6e9e6d4ba7d973730190138f136 Reviewed-by: Cristian Adam <cristian.adam@qt.io>