aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-10-27 12:02:54 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-02 10:34:39 +0000
commit47cb1bb53f4882ca7f00e2286f279279d8b74715 (patch)
treed6c3c8b50e78deac04eb3557616428c4cf4dd739
parentf44aabad32c6b2b905fe684217a1beab8476ceac (diff)
Stage all qml modules to a common directory when building for Android
All qml modules that are build in the user's project tree need to have a common output directory, when building for Android. This directory is used as qml import path when running androiddeployqt and provides the set of qml modules for the Android application. If user manually specifies either OUTPUT_DIRECTORY argument of the qt6_add_qml_module function or QT_QML_OUTPUT_DIRECTORY variable, it's also necessary to add this value to the QT_QML_IMPORT_PATH property of android application target that uses the module. Also few corrections in Qt6QmlMacros.cmake. Task-number: QTBUG-96898 Fixes: QTBUG-97806 Change-Id: If2cd1849438aaee519b1c4c5441b31c534542923 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 7a7064e14f094e843e1ee832cc927e86f887621a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/Qt6QmlConfigExtras.cmake.in7
-rw-r--r--src/qml/Qt6QmlMacros.cmake1
-rw-r--r--src/qml/doc/src/cmake/cmake-variables.qdoc13
3 files changed, 20 insertions, 1 deletions
diff --git a/src/qml/Qt6QmlConfigExtras.cmake.in b/src/qml/Qt6QmlConfigExtras.cmake.in
index 3d5be2c22c..194dc9eef2 100644
--- a/src/qml/Qt6QmlConfigExtras.cmake.in
+++ b/src/qml/Qt6QmlConfigExtras.cmake.in
@@ -11,3 +11,10 @@ if(NOT QT_NO_CREATE_TARGETS AND
qt@PROJECT_VERSION_MAJOR@_import_qml_plugins
)
endif()
+
+if(ANDROID)
+ # Set the default staging path of qml modules when building for Android
+ if("${QT_QML_OUTPUT_DIRECTORY}" STREQUAL "")
+ set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/android-qml")
+ endif()
+endif()
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index 5ffc39d0ca..ddb49640db 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -1436,7 +1436,6 @@ function(qt6_target_qml_sources target)
get_filename_component(file_absolute ${qml_file_src} ABSOLUTE)
__qt_get_relative_resource_path_for_file(file_resource_path ${qml_file_src})
- set(qml_file_out ${output_dir}/${file_resource_path})
# For the tooling steps below, run the tools on the copied qml file in
# the build directory, not the source directory. This is required
diff --git a/src/qml/doc/src/cmake/cmake-variables.qdoc b/src/qml/doc/src/cmake/cmake-variables.qdoc
index 7abd1c6f03..8f5b87b1cb 100644
--- a/src/qml/doc/src/cmake/cmake-variables.qdoc
+++ b/src/qml/doc/src/cmake/cmake-variables.qdoc
@@ -53,6 +53,19 @@ modules under the same base location. This allows the project to use a source
directory structure that doesn't exactly match the URI structure of the QML
modules, or to merge sets of QML modules under a common base point.
+When building QML modules for Android, \c QT_QML_OUTPUT_DIRECTORY is set to
+\c{${CMAKE_BINARY_DIR}/android-qml} by default. The Android deployment routine
+uses this directory to locate the required QML modules in the build tree.
+The output directory of a QML module can also be set for a project or for each
+QML module target by the user and it can therefore differ from the Android
+default directory. In this case, to successfully deploy the executable on
+Android, the \e{target path} of the QML module must be based on the module URI.
+Also, the \l{cmake-target-property-QT_QML_IMPORT_PATH}{QT_QML_IMPORT_PATH}
+property of the executable target must contain the import paths of all QML
+modules that are built in the project tree, have a custom output directory,
+and are used by the executable target. This behavior will likely change in
+a future Qt version due to improvements in the build system implementation.
+
*/