Android: Add variable to opt-in QtQmlComponent code generation

The CMake variable QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
will add "is_generate_java_qml_components" property to the
android-deployment-settings.json file to be read by
androiddeployqt, that enables/disables QtQmlComponent Java
code generation of QML components.

Task-number: QTBUG-124846
Change-Id: I5b3dc009aaa18beaa533296ce489e09c09d864e0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
This commit is contained in:
Soheil Armin 2024-05-19 20:17:16 +03:00
parent 7282c54fe6
commit 876991d8b7
2 changed files with 30 additions and 0 deletions

View File

@ -300,6 +300,13 @@ function(qt6_android_generate_deployment_settings target)
string(APPEND file_contents
" \"zstdCompression\": ${is_zstd_enabled},\n")
if(QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS)
set(is_generate_java_qml_components "true")
else()
set(is_generate_java_qml_components "false")
endif()
string(APPEND file_contents
" \"generate-java-qml-components\": ${is_generate_java_qml_components},\n")
# Last item in json file
# base location of stdlibc++, will be suffixed by androiddeploy qt

View File

@ -317,6 +317,29 @@ The mentioned variables are used internally by \l{androiddeployqt}.
\sa{androiddeployqt}
*/
/*!
\page cmake-variable-qt-android-generate-java-qml-components.html
\ingroup cmake-variables-qtcore
\ingroup cmake-android-build-properties
\title QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
\target cmake-variable-QT_ANDROID_GENERATE_JAVA_QML_COMPONENTS
\summary {Enables the generation of QtQmlComponent-based classes.}
\cmakevariablesince 6.8
\preliminarycmakevariable
\cmakevariableandroidonly
This variable enables Java code generation for QML components of the target application. The
generated code will be included in the resulting package. The Java package name of generated
classes will be the same as the Android app package. If the leaf part of the package name is
not the same as the target executable, an extra static class with the same name as the
capitalized target executable will surround all QML modules enclosing Java classes. Each QML
module class, again in a capitalized form, will contain QtQmlComponent extension classes that
represent QML components of that module.
*/
\sa{androiddeployqt}
/*!
\page cmake-variable-qt-use-target-android-build-dir.html
\ingroup cmake-variables-qtcore