From 45ce3c6fb99e796c8dcee1d8788cb8df11308967 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Thu, 4 Nov 2021 16:40:30 +0100 Subject: Make sure that all MODULE_LIBRARY targets are built before deploying to Android Users may add the implicit runtime depedencies to the MODULE_LIBRARY targets, that are created using standard CMake API. When iterating a project tree we collect all module libraries and add them as dependencies to the qt_internal_plugins meta target. All the ${target}_make_apk targets depend on this meta target, so we can be sure that plugins are built and present on the file system before running androiddeployqt. Task-number: QTBUG-94714 Task-number: QTBUG-88841 Change-Id: I4fa7f0772d23897f19db59c6e4ad38646bd3aed6 Reviewed-by: Alexandru Croitor --- src/corelib/Qt6AndroidMacros.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index 2baa764027..9ccdde0be0 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -469,9 +469,21 @@ function(_qt_internal_collect_target_apk_dependencies target) _qt_internal_collect_buildsystem_shared_libraries(libs "${CMAKE_SOURCE_DIR}") + if(NOT TARGET qt_internal_plugins) + add_custom_target(qt_internal_plugins) + endif() + foreach(lib IN LISTS libs) if(NOT lib IN_LIST apk_targets) list(APPEND extra_prefix_dirs "$") + get_target_property(target_type ${lib} TYPE) + # We collect all MODULE_LIBRARY targets since target APK may have implicit dependency + # to the plugin that will cause the runtime issue. Plugins that were added using + # qt6_add_plugin should be already added to the qt_internal_plugins dependency list, + # but it's ok to re-add them. + if(target_type STREQUAL "MODULE_LIBRARY") + add_dependencies(qt_internal_plugins ${lib}) + endif() endif() endforeach() -- cgit v1.2.3