Change the way tests and examples query the qmldir file from QML plugin targets
Use qt6_query_qml_module to get path to qmldir, but not TARGET_FILE_DIR. This is more accurate way. Fixes: QTBUG-120479 Change-Id: I4b7f7bf3b7f69c15871e400af3e7ae945a9bfdf0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commitd276d025a8
) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit5e60f6d141
) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit7d26fdbe1c
)
This commit is contained in:
parent
2aead33163
commit
aef40493f7
|
@ -45,7 +45,5 @@ install(TARGETS painteditemexample
|
|||
include(../../shared/QtBundleQmlModuleForMacOS.cmake)
|
||||
|
||||
set(app_target "painteditemexample")
|
||||
set(qml_plugin_target "qmltextballoon")
|
||||
set(qml_module_uri "TextBalloon")
|
||||
add_qml_module_to_macos_app_bundle(
|
||||
"${app_target}" "${qml_plugin_target}" "${qml_module_uri}")
|
||||
set(qml_module "qmltextballoon")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "${qml_module}")
|
||||
|
|
|
@ -42,10 +42,8 @@ include(QtBundleQmlModuleForMacOS.cmake)
|
|||
# Puts the shared qml module plugin and qmldir into the macOS app bundle directory.
|
||||
# Only call this function if your main project has the MACOSX_BUNDLE option set.
|
||||
function(bundle_shared app_target)
|
||||
set(qml_plugin_target "${PROJECT_NAME}_shared")
|
||||
set(qml_module_uri "shared")
|
||||
add_qml_module_to_macos_app_bundle(
|
||||
"${app_target}" "${qml_plugin_target}" "${qml_module_uri}")
|
||||
set(qml_module_target "${PROJECT_NAME}_shared")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "${qml_module_target}")
|
||||
endfunction()
|
||||
|
||||
set(INSTALL_SHAREDDIR "${INSTALL_EXAMPLESDIR}/quick/${PROJECT_NAME}/shared")
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
function(add_qml_module_to_macos_app_bundle app_target qml_plugin_target qml_module_uri)
|
||||
function(add_qml_module_to_macos_app_bundle app_target qml_module)
|
||||
if(QT6_IS_SHARED_LIBS_BUILD AND APPLE)
|
||||
# The application's main.cpp adds an explicit QML import path to look for qml module plugins
|
||||
# under a PlugIns subdirectory of a macOS app bundle.
|
||||
# Copy the qmldir and shared library qml plugin.
|
||||
|
||||
qt6_query_qml_module(${qml_module}
|
||||
QMLDIR qmldir_file
|
||||
PLUGIN_TARGET qml_plugin_target
|
||||
URI qml_module_uri
|
||||
)
|
||||
|
||||
# Ensure the executable depends on the plugin so the plugin is copied
|
||||
# only after it was built.
|
||||
add_dependencies(${app_target} ${qml_plugin_target})
|
||||
|
@ -17,9 +23,6 @@ function(add_qml_module_to_macos_app_bundle app_target qml_plugin_target qml_mod
|
|||
|
||||
set(dest_module_dir_in_app_bundle "${app_dir}/../PlugIns/${escaped_uri}")
|
||||
|
||||
set(qml_plugin_dir "$<TARGET_FILE_DIR:${qml_plugin_target}>")
|
||||
set(qmldir_file "${qml_plugin_dir}/qmldir")
|
||||
|
||||
add_custom_command(TARGET ${app_target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dest_module_dir_in_app_bundle}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
|
|
|
@ -46,7 +46,5 @@ install(TARGETS attachedstylepropertiesexample
|
|||
include(../../quick/shared/QtBundleQmlModuleForMacOS.cmake)
|
||||
|
||||
set(app_target "attachedstylepropertiesexample")
|
||||
set(qml_plugin_target "MyStyleplugin")
|
||||
set(qml_module_uri "MyStyle")
|
||||
add_qml_module_to_macos_app_bundle(
|
||||
"${app_target}" "${qml_plugin_target}" "${qml_module_uri}")
|
||||
set(qml_module_target "MyStyle")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "${qml_module_target}")
|
||||
|
|
|
@ -54,6 +54,6 @@ install(TARGETS wearableexample
|
|||
include(../../quick/shared/QtBundleQmlModuleForMacOS.cmake)
|
||||
|
||||
set(app_target "wearableexample")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "wearable" "Wearable")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "wearablesettings" "WearableSettings")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "wearablestyle" "WearableStyle")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "wearable")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "wearablesettings")
|
||||
add_qml_module_to_macos_app_bundle("${app_target}" "wearablestyle")
|
||||
|
|
Loading…
Reference in New Issue