Skip to content

Commit 8977feb

Browse files
committed
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>
1 parent 2be0260 commit 8977feb

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

cmake/QtBuildHelpers.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ function(qt_internal_get_qt_build_public_helpers out_var)
289289
QtPublicFindPackageHelpers
290290
QtPublicGitHelpers
291291
QtPublicPluginHelpers
292+
QtPublicPluginHelpers_v2
292293
QtPublicSbomGenerationHelpers
293294
QtPublicSbomHelpers
294295
QtPublicTargetHelpers

cmake/QtPublicPluginHelpers_v2.cmake

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (C) 2024 The Qt Company Ltd.
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
function(__qt_internal_collect_plugin_targets_from_dependencies_v2 target out_var)
5+
if(CMAKE_VERSION VERSION_LESS 3.30)
6+
__qt_internal_collect_plugin_targets_from_dependencies("${target}" "${out_var}")
7+
set(${out_var} "${${out_var}}" PARENT_SCOPE)
8+
return()
9+
endif()
10+
set("${out_var}" "$<TARGET_PROPERTY:${target},QT_PLUGIN_TARGETS>" PARENT_SCOPE)
11+
endfunction()
12+
13+
function(__qt_internal_collect_plugin_library_files_v2 target plugin_targets out_var)
14+
if(CMAKE_VERSION VERSION_LESS 3.30)
15+
__qt_internal_collect_plugin_library_files("${target}" "${plugin_targets}" "${out_var}")
16+
set(${out_var} "${${out_var}}" PARENT_SCOPE)
17+
return()
18+
endif()
19+
20+
set(plugin_targets "$<GENEX_EVAL:${plugin_targets}>")
21+
22+
# Convert the list of plugin targets to a list of plugin files
23+
set(pre_genex "$$<1:<TARGET_FILE:>")
24+
set(post_genex "$<ANGLE-R>")
25+
set(glue "${post_genex};${pre_genex}")
26+
set("${out_var}"
27+
"$<$<BOOL:${plugin_targets}>:$<GENEX_EVAL:${pre_genex}$<JOIN:${plugin_targets},${glue}>${post_genex}>>"
28+
PARENT_SCOPE
29+
)
30+
endfunction()

src/corelib/Qt6AndroidMacros.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ function(qt6_android_generate_deployment_settings target)
290290
_qt_internal_add_android_deployment_property(file_contents "android-no-deploy-qt-libs"
291291
${target} "QT_ANDROID_NO_DEPLOY_QT_LIBS")
292292

293-
__qt_internal_collect_plugin_targets_from_dependencies("${target}" plugin_targets)
294-
__qt_internal_collect_plugin_library_files("${target}" "${plugin_targets}" plugin_targets)
293+
__qt_internal_collect_plugin_targets_from_dependencies_v2("${target}" plugin_targets)
294+
__qt_internal_collect_plugin_library_files_v2("${target}" "${plugin_targets}" plugin_targets)
295295
string(APPEND file_contents " \"android-deploy-plugins\":\"${plugin_targets}\",\n")
296296

297297
_qt_internal_generate_android_permissions_json(permissions_json_array "${target}")

0 commit comments

Comments
 (0)