Introduce a new way of collecting plugin targets

Use the propagated interface property to collect the plugins for the
android deployment. This method allows collecting plugins from the Qt
libraries without using walk-libs approach with all its disadvantages.

The only limitation is the CMake version, since custom transitive
properties support was added in the CMake version 3.30.

For now it's only uses in Android deployment, will be spread wider
in followup commits.

Fixes: QTBUG-129302
Change-Id: I8d5ae7342d57d215021ad02c51dda44f88c9a920
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2024-11-01 13:53:31 +01:00
parent 2be02608ae
commit 8977feb647
3 changed files with 33 additions and 2 deletions

View File

@ -289,6 +289,7 @@ function(qt_internal_get_qt_build_public_helpers out_var)
QtPublicFindPackageHelpers
QtPublicGitHelpers
QtPublicPluginHelpers
QtPublicPluginHelpers_v2
QtPublicSbomGenerationHelpers
QtPublicSbomHelpers
QtPublicTargetHelpers

View File

@ -0,0 +1,30 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(__qt_internal_collect_plugin_targets_from_dependencies_v2 target out_var)
if(CMAKE_VERSION VERSION_LESS 3.30)
__qt_internal_collect_plugin_targets_from_dependencies("${target}" "${out_var}")
set(${out_var} "${${out_var}}" PARENT_SCOPE)
return()
endif()
set("${out_var}" "$<TARGET_PROPERTY:${target},QT_PLUGIN_TARGETS>" PARENT_SCOPE)
endfunction()
function(__qt_internal_collect_plugin_library_files_v2 target plugin_targets out_var)
if(CMAKE_VERSION VERSION_LESS 3.30)
__qt_internal_collect_plugin_library_files("${target}" "${plugin_targets}" "${out_var}")
set(${out_var} "${${out_var}}" PARENT_SCOPE)
return()
endif()
set(plugin_targets "$<GENEX_EVAL:${plugin_targets}>")
# Convert the list of plugin targets to a list of plugin files
set(pre_genex "$$<1:<TARGET_FILE:>")
set(post_genex "$<ANGLE-R>")
set(glue "${post_genex};${pre_genex}")
set("${out_var}"
"$<$<BOOL:${plugin_targets}>:$<GENEX_EVAL:${pre_genex}$<JOIN:${plugin_targets},${glue}>${post_genex}>>"
PARENT_SCOPE
)
endfunction()

View File

@ -290,8 +290,8 @@ function(qt6_android_generate_deployment_settings target)
_qt_internal_add_android_deployment_property(file_contents "android-no-deploy-qt-libs"
${target} "QT_ANDROID_NO_DEPLOY_QT_LIBS")
__qt_internal_collect_plugin_targets_from_dependencies("${target}" plugin_targets)
__qt_internal_collect_plugin_library_files("${target}" "${plugin_targets}" plugin_targets)
__qt_internal_collect_plugin_targets_from_dependencies_v2("${target}" plugin_targets)
__qt_internal_collect_plugin_library_files_v2("${target}" "${plugin_targets}" plugin_targets)
string(APPEND file_contents " \"android-deploy-plugins\":\"${plugin_targets}\",\n")
_qt_internal_generate_android_permissions_json(permissions_json_array "${target}")