aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-08-25 16:20:34 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-31 06:49:39 +0000
commit0eef1d662f24dacca4ca563a3ad47aee0bc83858 (patch)
tree701ba6750944430b2f11c06b46aa6783ee6fbc54 /examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro
parent0cca1f27fe32fdf62850b2037509ff1d516a6309 (diff)
CMake: qmake: Fix chapter6-plugins example to build in more configs
Before this change, I tested the following configurations / scenarios (1) shared Qt + qmake + macOS bundle -> works (2) shared Qt + CMake + macOS bundle -> broken (3) static Qt + qmake + macOS bundle -> broken (4) static Qt + CMake + macOS bundle -> works (2) was broken because the shared qml plugin is not located in the expected location (see below) (3) was broken because qmake needs a lot of error-prone boilerplate to ensure static qml plugin building and linking works. The change fixes the example to build and run successfully in case (2). Tested the following scenarios on macOS with the change shared Qt + qmake + macOS bundle -> works shared Qt + CMake + macOS bundle -> works shared Qt + qmake + no bundle -> works shared Qt + CMake + no bundle -> works static Qt + qmake -> still broken static Qt + CMake -> works To make shared qml plugins be found in a macOS bundle, we need to copy the qmldir and plugin under the bundle's PlugIns subfolder, because the application adds that as the expected qml import path for macOS. This basically mimics what the qmake project does with QMAKE_BUNDLE_DATA. The change also cleans up the CMake projects a bit so they don't link PUBLIC-ly against dependencies, install the plugin under a more sensible location and don't needlessly setup package finding and other boilerplate that's done in the parent project. The change also cleans up the qmake projects to adjust to not pollute the macos bundle dir with static plugin files. Amends 9e1d2a0eb15487f8f2acb4d91b281568897fb4e1 Change-Id: I45bb699a67adf598587350a03f778291fad3f850 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 9cbf4d2cc85723dadadadb5fe1ade9719dfeb2a6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro')
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro
index b340981e42..8f53075a7d 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro
@@ -3,9 +3,9 @@ QT += qml quick
# Ensure that the application will see the import path for the Charts module:
# * On Windows, do not build into a debug/release subdirectory.
-# * On OS X, add the plugin files into the bundle.
+# * On macOS, add the plugin files into the bundle, only in a shared build though
win32: DESTDIR = ./
-osx {
+macos:!qtConfig(static) {
charts.files = $$OUT_PWD/Charts
charts.path = Contents/PlugIns
QMAKE_BUNDLE_DATA += charts