diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-09-25 09:48:12 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-09-26 08:16:56 +0200 |
commit | 854ee1c03c662ba5c059ad3d3a19d2c2dc750d15 (patch) | |
tree | 282427382d0a2e6a403c3e3ad7d0c1ea6c64e93f /src/qml/Qt6QmlDeploySupport.cmake | |
parent | 9c8d76b6ce036fe5e5f17cdcff3c6b22f15b4b65 (diff) |
CMake: Fix deployment of QML plugins for debug-and-release Qt
For simplicity, whenever we mention debug-and-release in this commit
message, we mean the more general concept of "multi-configuration build
with a debug configuration".
When deploying a QtQuick application that was built against a
debug-and-release Qt (like the Windows one that comes with the
installer), we copied both builds of a QML plugin to the installation
directory.
Now, when we've detected that the used Qt is a debug-and-release build,
we match exactly against the debug suffix if our application is a debug
build, or the absence of the debug suffix if our application is a
release build.
For non-debug-and-release Qt builds we leniently match against any debug
suffix, including the empty one, as before.
Pick-to: 6.5 6.6
Fixes: QTBUG-109444
Change-Id: I0d02cce2be871286fa6e9bac521d692e96c1bbf0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlDeploySupport.cmake')
-rw-r--r-- | src/qml/Qt6QmlDeploySupport.cmake | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/qml/Qt6QmlDeploySupport.cmake b/src/qml/Qt6QmlDeploySupport.cmake index a7319e8449..21922c8855 100644 --- a/src/qml/Qt6QmlDeploySupport.cmake +++ b/src/qml/Qt6QmlDeploySupport.cmake @@ -192,9 +192,23 @@ function(_qt_internal_deploy_qml_imports_for_target) continue() endif() + # Construct a regular expression that matches the plugin's file name. + set(plugin_regex "^(.*/)?(lib)?${entry_PLUGIN}") + if(__QT_DEPLOY_QT_IS_MULTI_CONFIG_BUILD_WITH_DEBUG) + # If our application is a release build, do not match any debug suffix. + # If our application is a debug build, match exactly a debug suffix. + if(__QT_DEPLOY_ACTIVE_CONFIG STREQUAL "Debug") + string(APPEND plugin_regex "${__QT_DEPLOY_QT_DEBUG_POSTFIX}") + endif() + else() + # The Qt installation does only contain one build of the plugin. We match any + # possible debug suffix, or none. + string(APPEND plugin_regex ".*") + endif() + string(APPEND plugin_regex "\\.(so|dylib|dll)(\\.[0-9]+)*$") + file(GLOB files LIST_DIRECTORIES false "${entry_PATH}/*${entry_PLUGIN}*") - list(FILTER files - INCLUDE REGEX "^(.*/)?(lib)?${entry_PLUGIN}.*\\.(so|dylib|dll)(\\.[0-9]+)*$") + list(FILTER files INCLUDE REGEX "${plugin_regex}") file(INSTALL ${files} DESTINATION "${install_plugin}" USE_SOURCE_PERMISSIONS) get_filename_component(dest_plugin_abs "${dest_plugin}" ABSOLUTE) |