aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/Qt6QmlDeploySupport.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-13 18:55:19 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-03-15 21:03:00 +0100
commitec736c78c397982938e6a09b014f64268f62bc8f (patch)
tree5ff61851eb9577a60f8da38e3df5ec281a3cc411 /src/qml/Qt6QmlDeploySupport.cmake
parent71af3fde8071db75d5a09d4693cb9442bfe64504 (diff)
CMake: Fix macOS deployment POST_BUILD step for debug configs
The symlinking of plugin names during the macOS deployment POST_BUILD step never considered whether the debug or release plugin of Qt should be symlinked. Just like we do for regular deployment installation, use the file name from the deploy support targets file if available. If not, use the values of __QT_DEPLOY_ACTIVE_CONFIG and __QT_DEPLOY_QT_DEBUG_POSTFIX to decide if a postfix is needed. In the future, we should try to merge both the POST_BUILD and installation code paths if possible. Amends 2a77a85c8bb52b421ede95c81f24cf157006c4c5 Pick-to: 6.7 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Task-number: QTBUG-102057 Change-Id: I644d5a38fc6e5cfb454c47d307d6d13fabc35cfa Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlDeploySupport.cmake')
-rw-r--r--src/qml/Qt6QmlDeploySupport.cmake27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/qml/Qt6QmlDeploySupport.cmake b/src/qml/Qt6QmlDeploySupport.cmake
index cee9b9bef2..fb1f522629 100644
--- a/src/qml/Qt6QmlDeploySupport.cmake
+++ b/src/qml/Qt6QmlDeploySupport.cmake
@@ -177,10 +177,33 @@ function(_qt_internal_deploy_qml_imports_for_target)
# supports symlinks (which all do in some form now, even
# Windows if the right permissions are set), but we only really
# expect to need this for macOS app bundles.
- set(final_destination "${dest_qmldir}/lib${entry_PLUGIN}.dylib")
+ if(DEFINED __QT_DEPLOY_TARGET_${entry_LINKTARGET}_FILE)
+ set(source_file "${__QT_DEPLOY_TARGET_${entry_LINKTARGET}_FILE}")
+ get_filename_component(source_file_name "${source_file}" NAME)
+ set(final_destination "${dest_qmldir}/${source_file_name}")
+ else()
+ # TODO: This is inconsistent with what we do further down below for the
+ # installation case. There we file(GLOB) any files we find, whereas here we
+ # build the path manually, because the file might not exist yet.
+ # Ideally both cases should use neither file(GLOB) nor manual path building,
+ # and instead rely on available target information or qmldir information.
+ # Currently that is not possible because we don't have all targets exposed
+ # via the __QT_DEPLOY_TARGET_{target} mechanism, only those that are built as
+ # part of the current project, and the qmldir -> qmlimportscanner does print
+ # the full file path, because there is one qmldir, but possibly 2+ plugins
+ # (debug and release).
+ set(plugin_suffix "")
+ if(__QT_DEPLOY_ACTIVE_CONFIG STREQUAL "Debug")
+ string(APPEND plugin_suffix "${__QT_DEPLOY_QT_DEBUG_POSTFIX}")
+ endif()
+
+ set(source_file "${entry_PATH}/lib${entry_PLUGIN}${plugin_suffix}.dylib")
+ set(final_destination "${dest_qmldir}/lib${entry_PLUGIN}${plugin_suffix}.dylib")
+ endif()
+
message(STATUS "Symlinking: ${final_destination}")
file(CREATE_LINK
- "${entry_PATH}/lib${entry_PLUGIN}.dylib"
+ "${source_file}"
"${final_destination}"
SYMBOLIC
)