summaryrefslogtreecommitdiffstats
path: root/cmake/QtPlatformAndroid.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Rename some additional functions that should be internalAlexandru Croitor2020-10-121-1/+1
| | | | | | | | | Amends e0c62a48b8a826a46a143e57e94b2a0ea73c7cae Task-number: QTBUG-86815 Change-Id: Ic65d8dda1aed390c78408616fb22f38edd2e1dce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix typo in ANDROID_SDK_ROOT's help textJoerg Bornemann2020-10-061-1/+1
| | | | | Change-Id: I1edc7e7ae443c306aca64b8f6a92c8b32fad6117 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: fix sdkBuildToolsRevision not being set for user appsAssam Boudjelthia2020-09-291-25/+3
| | | | | | | | | | | 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-2/+2
| | | | | | | | | 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: use ANDROID_SDK_ROOT instead of ANDROID_SDK consistentlyAssam Boudjelthia2020-09-261-1/+1
| | | | | | | | Make the use of ANDROID_SDK_ROOT consistent. Task-number: QTCREATORBUG-24678 Change-Id: If967bdc4d252996098fa210cf38429fe075eacb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: partially revert 00a1e5dAssam Boudjelthia2020-09-231-216/+0
| | | | | | | | | | 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: add option to get app arguments with AndroidManifest.xmlAssam Boudjelthia2020-08-281-1/+225
| | | | | | | | | | | AndroidManifest.xml file and the Android plugin already has a way to provide commandline-arguments to app with the tag "android.app.arguments". This change allow to set it from qmake/cmake and allow Qt Creator to use that. Task-number: QTCREATORBUG-23712 Change-Id: I3e680f40fd36ba6aaac7f344fb9509d2c3360e74 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* CMake: Split out some Android functions into a public API fileAlexandru Croitor2020-08-141-240/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Fix various issues with building CMake Android projectsAlexandru Croitor2020-08-141-10/+37
| | | | | | | | | | | | | | | | | | | | | Fix detection of qt android platform plugin by globbing inside the install qt6 prefix location. This is just a sanity check. Fix platform plugin detection for CMake standalone tests configured using qt-cmake-standalone-test, which used to look into the fake standalone prefix location instead of the real Qt location. Fix detection of stdlib path using CMAKE_SYSROOT. Add a global apk target that allows easier building of all apk targets defined in the project. Creation of this target can be opted out by setting QT_NO_GLOBAL_APK_TARGET to TRUE. Amends b1f8ca8032bd0500f356c55c335937f7fb89d3f5. Task-number: QTBUG-85399 Change-Id: Ic9c1646b4f00e0084fe3f4397df471b8f925afd8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Raise the Android SDK build requirement to lvl 28 - compile fixAlex Blasche2020-06-231-1/+1
| | | | | | | | | | | | | | | First of all cmake and qmake used a different standard. Secondly, the qmake logic enforced lvl 23 (if it was installed which is the case on the failing machine). When this is combined with f71a400bf61 which requires lvl 28 API to build, the android build fails to compile. cmake logic was even worse as it enforced lvl 21 API to be used if installed. This change requires pick to 5.15 as f71a400bf61 was picked as well. Pick-to: 5.15 Change-Id: I89a7193b711b8bf927d02907343a49d6f27082ce Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* CMake: Fix wrong arm64 architectureLeander Beernaert2020-04-271-1/+1
| | | | | | | | | | Due to the wrong string comparison, we were writing out the wrong architecture for the arm64 builds to the deployment settings json file. This leads to androiddeployqt tool not being able to locate the stdlibc++. Change-Id: I3d13b14c27f043445bf46aaca0e9f862f6ca84e5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Enable running test on AndroidLeander Beernaert2019-10-281-1/+28
| | | | | | | | | This patch converts all add_executable calls when building for Android to a module library and replaces the call to add_test() to use the android testrunner binary. Change-Id: I10ba5919217cdc93cc2cbbb7d13ad9d10fc5ac1a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add custom targets to generate Android APKLeander Beernaert2019-10-231-1/+27
| | | | | | | | | | This patch adds two custom targets to generate android apks. The targets are named ${TARGET}_prepare_apk_dir and ${TARGET}_make_apk. The first one insures the binary is copied to the right location and the latter invokes androiddeployqt on the apk directory. Change-Id: I8152cef387b50ec03ee2bfd92b56910a6f22754c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add conversion code for Java codeLeander Beernaert2019-10-181-0/+12
| | | | | | | | | | Add support to pro2cmake to convert java code for android. Add support to override API_LEVEL for the Android sdk jar file. If the sdk is not found, we'll default to the one located by QT_ANDROID_JAR. Change-Id: If0b746dc7f9148ac43e6592a4a4dd23d46bbd4cd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Override qmlimportscanner path in android deployment settingsLeander Beernaert2019-08-301-1/+10
| | | | | | | | Override the default binary path for qmlimportscanner so that it points to the host build specified via QT_HOST_PATH. Change-Id: Ib0b47e61315c87ce6225e2d8ca84043cae03357d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update Android build configurationLeander Beernaert2019-08-301-32/+50
| | | | | | | | | | | | | | | | | | Update Android build configuration to be compatible with the multi-arch android build patch to qmake. We can now build and generate the apk correctly. Executing on the device/simulator will only work once the latest changes from 5.14 have been merged in. We now replace target suffix with ${CMAKE_ANDROID_ARCH_ABI}.[so|a] so we don't have to deal with handling targets which might have any of the OUTPUT_NAME properties set. The dependency and deploy settings generation has also been updated to append the file contents to a string and then do a single file write at the end. Change-Id: Id3c5bd0428141ecaf962124a100390e3a4e41feb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add missing qml-root-path for AndroidLeander Beernaert2019-08-281-16/+14
| | | | | | | | | | | | Add missing qml root path variable in the deployment configuration file. Not having this variable will cause androiddeployqt not use the qml dependency scanner to package all relevant dependencies. This patch also fixes QT_ANDROID_BUNDLED_FILES files not being processed. Change-Id: I5bca33cdbb57098f283b38516b777571806da9e5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: Final changes for APK generationLeander Beernaert2019-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | Generate the ${MODULE}-android-dependencies.xml for the androiddeployqt tool. This will ensure all the right plugins and dependencies are packaged when generating the apk. This change also changes the visibility for executable to default/public. Not having this will cause the application to crash as we can't locate main() in the executable (shared library). Additionally pro2cmake conversion script has been updated to perform the required conversions for the Android settings. Finally, the 6 projects in QtBase that have Android dependencies have been updated with the new script and the step that produces the xml files in run at the end in QtPostProcess.cmake. Change-Id: I9774ba1b123bc11cae972fa37054ef2c51988498 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-06-141-2/+2
| | | | | | | | | | This changes many different CMake places to mention Qt6 instead of Qt5. Note that some old qt5 cmake config files in corelib are probably not needed anymore, but I still renamed and kept them for now. Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
* Fix compiling of examples on AndroidSimon Hausmann2019-06-121-6/+6
| | | | | | | | | | | | | | | | | | | * Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE but provide it implicitly. It's redundant :) * When on Android, build a module (shared library), just like qmake. This requires an additional library destination in the install() call, but that's ignored on other platforms. * Fix typos in the android deployment generation settings function * Use the correct cache variable to determine whether we're inside a Qt build or not. Right now this only works inside Qt builds anyway as QtPlatformAndroid.cmake is not publically accessible. Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Android: Generate deployment-settings.jsonLeander Beernaert2019-06-121-10/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate the android deployment settings json for android apk targets. QtPlatformAndroid is now also deployed as a public build dependency of QtCore. Some minor refactoring has been performed to the naming of variables and functions to better match the public facing apis. Extra settings for the file can be configured using the following target properties: set_target_properties(Core PROPERTIES QT_ANDROID_DEPLOYMENT_DEPENDENCIES "foo;bar" QT_ANDROID_EXTRA_LIBS "foo;bar" QT_ANDROID_EXTRA_PLUGINS "foo;bar" QT_ANDROID_PACKAGE_SOURCE_DIR "/foo/bar/" ) The file is generated using the function qt_android_generate_depoyment_settings(). We need to install the android template files and jar files during the android build as the androiddeployqt tool wont work if parts of it are split between the host install and the android install. Added QT_BUILD_QT variable to check whether we are building Qt from source. Finally, we also force the stdlib to shared via cmake configuration with -DANDROID_STL="c++_shared" Change-Id: I063c47e11749d56ba4c6f02101dbcc09e1b9fe87 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Android: SDK SupportLeander Beernaert2019-06-051-0/+44
Enable building androiddeployqt when performing host builds only. Added QtPlatformAndroid.cmake to locate Java and the setup the android SDK platform when building on android. Install the androiddeployqt support files when performing a host build. Added ANDROID_SDK_ROOT configuration variable for specifying the android sdk directory. Generating the deployment-settings.json will be done in another change. Change-Id: I1bf15315af4ed904d2fb1d22b0e8e834df32d6ed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>