From add4c4816c3979c9830af95348c2d5fe51f5125c Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Tue, 27 Aug 2019 18:05:13 +0200 Subject: Add missing qml-root-path for Android 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 --- cmake/QtBuild.cmake | 7 ++++- .../QtBuildInternals/QtBuildInternalsAndroid.cmake | 4 ++- cmake/QtPlatformAndroid.cmake | 30 ++++++++++------------ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index a587ff8d4a..3370cb7e6b 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -2123,7 +2123,12 @@ function(add_qml_module target) string(REPLACE "." "_" qmldir_resource_name ${arg_TARGET_PATH}) string(REPLACE "/" "_" qmldir_resource_name ${qmldir_resource_name}) set(qmldir_resource_name "${qmldir_resource_name}_qmldir") - add_qt_resource(${target} ${uri_target} + get_target_property(target_resource_prefix ${target} QT_RESOURCE_PREFIX) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/qmldir" + PROPERTIES QT_RESOURCE_ALIAS "qmldir" + ) + add_qt_resource(${target} ${qmldir_resource_name} + PREFIX ${target_resource_prefix} FILES "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" ) endif() diff --git a/cmake/QtBuildInternals/QtBuildInternalsAndroid.cmake b/cmake/QtBuildInternals/QtBuildInternalsAndroid.cmake index 4677c9dcae..ecba1dd08f 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsAndroid.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsAndroid.cmake @@ -74,6 +74,7 @@ function(qt_android_dependencies target) get_target_property(arg_BUNDLED_JAR_DEPENDENCIES ${target} QT_ANDROID_BUNDLED_JAR_DEPENDENCIES) get_target_property(arg_LIB_DEPENDENCIES ${target} QT_ANDROID_LIB_DEPENDENCIES) get_target_property(arg_LIB_DEPENDENCY_REPLACEMENTS ${target} QT_ANDROID_LIB_DEPENDENCY_REPLACEMENTS) + get_target_property(arg_BUNDLED_FILES ${target} QT_ANDROID_BUNDLED_FILES) get_target_property(arg_PERMISSIONS ${target} QT_ANDROID_PERMISSIONS) get_target_property(module_plugins ${target} MODULE_PLUGIN_TYPES) @@ -82,7 +83,8 @@ function(qt_android_dependencies target) AND (NOT arg_LIB_DEPENDENCY_REPLACEMENTS) AND (NOT arg_LIB_DEPENDENCIES) AND (NOT arg_BUNDLED_JAR_DEPENDENCIES) - AND (NOT arg_PERMISSIONS)) + AND (NOT arg_PERMISSIONS) + AND (NOT arg_BUNDLED_FILES)) # None of the values were set, so there's nothing to do return() endif() diff --git a/cmake/QtPlatformAndroid.cmake b/cmake/QtPlatformAndroid.cmake index bc7e0aa862..6c27088765 100644 --- a/cmake/QtPlatformAndroid.cmake +++ b/cmake/QtPlatformAndroid.cmake @@ -251,22 +251,20 @@ endif() #TODO: ANDROID_VERSION_CODE, doesn't seem to be used? - #TODO: QML import path, could be a property? Example below: - #get_target_property(qml_import_path ${target} QT_QML_IMPORT_PATH) - #if (qml_import_path) - # file(TO_NATIVE_PATH "${qml_import_path}" qml_import_path_native) - # file(APPEND ${deploy_file} - # " \"qml-import-path\": \"${qml_import_path_native}\",\n") - #endif() - - #TODO: QML root path, could be a property? Example below: - #get_target_property(qml_root_path ${target} QT_QML_ROOT_PATH) - #if(NOT qml_root_path) - # set(qml_root_path "${target_source_dir}") - #endif() - #file(TO_NATIVE_PATH "${qml_root_path}" qml_root_path_native) - #file(APPEND ${deploy_file} - # " \"qml-root-path\": \"${qml_root_path_native}\",\n") + get_target_property(qml_import_path ${target} QT_QML_IMPORT_PATH) + if (qml_import_path) + file(TO_NATIVE_PATH "${qml_import_path}" qml_import_path_native) + file(APPEND ${deploy_file} + " \"qml-import-path\": \"${qml_import_path_native}\",\n") + endif() + + get_target_property(qml_root_path ${target} QT_QML_ROOT_PATH) + if(NOT qml_root_path) + set(qml_root_path "${target_source_dir}") + endif() + file(TO_NATIVE_PATH "${qml_root_path}" qml_root_path_native) + file(APPEND ${deploy_file} + " \"qml-root-path\": \"${qml_root_path_native}\",\n") # App binary file(TO_NATIVE_PATH "${target_binary_dir}/lib${target_output_name}.so" target_binary_dir_native) -- cgit v1.2.3