diff options
Diffstat (limited to 'mkspecs/features/qt.prf')
-rw-r--r-- | mkspecs/features/qt.prf | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index d13b9bb8d5..279540c384 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -124,33 +124,37 @@ if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \ QMAKE_CLEAN += $$QML_IMPORT_CPP # copy qml files. this part is platform spesific. - macx { - # copy to Contents/Resources in the bundle. - QmlImports.path = Contents/Resources/ - QmlImports.files *= $$QMLPATHS - QMAKE_BUNDLE_DATA += QmlImports + mac { + osx { + # Note: user can override QMAKE_BUNDLE_QML from pro file to change target bundle path + isEmpty(QMAKE_QML_BUNDLE_PATH):QMAKE_QML_BUNDLE_PATH = "Resources/qt_qml" + qmlTargetPath = $$OUT_PWD/$${TARGET}.app/Contents/$$QMAKE_QML_BUNDLE_PATH + qtconfTargetPath = $$OUT_PWD/$${TARGET}.app/Contents/Resources/qt.conf + } else { + # iOS: flat bundle layout (no Contents/Resources) + isEmpty(QMAKE_QML_BUNDLE_PATH):QMAKE_QML_BUNDLE_PATH = "qt_qml" + qmlTargetPath = $CODESIGNING_FOLDER_PATH/$$QMAKE_QML_BUNDLE_PATH + qtconfTargetPath = $CODESIGNING_FOLDER_PATH/qt.conf + } - # place qt.conf in Contents/Resources in the app bundle - QT_CONF_CONTENTS = \ - "[Paths]" \ - "Imports = Resources/qml" \ - "Qml2Imports = Resources/qml" - QT_CONF = "$$OUT_PWD/$${TARGET}.app/Contents/Resources/qt.conf" - write_file($$QT_CONF, QT_CONF_CONTENTS)|error("Aborting.") - } else: ios { - # flat bundle layout (no Contents/Resources) - QmlImports.files *= $$QMLPATHS - QMAKE_BUNDLE_DATA += QmlImports - - # write qt.conf to OUT_PWD and make xcode copy it via QMAKE_BUNDLE_DATA + # set import path in qt.conf to point to the bundeled qml: QT_CONF_CONTENTS = \ "[Paths]" \ - "Imports = qml" \ - "Qml2Imports = qml" - QT_CONF = "$$OUT_PWD/qt.conf" - write_file($$QT_CONF, QT_CONF_CONTENTS)|error("Aborting.") - QtConf.files = $$QT_CONF - QMAKE_BUNDLE_DATA += QtConf + "Imports = $$QMAKE_QML_BUNDLE_PATH" \ + "Qml2Imports = $$QMAKE_QML_BUNDLE_PATH" + write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error("Aborting.") + + # write qt.conf and copy each qml import dir into the bundle. + # But strip away archives and other files that are not needed: + !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";" + QMAKE_POST_LINK += \ + "cp $$OUT_PWD/qt.conf $$qtconfTargetPath; " \ + "test -d $$qmlTargetPath && rm -r $$qmlTargetPath; " \ + "mkdir -p $$qmlTargetPath && " \ + "for p in $$QMLPATHS; do" \ + "rsync -r --exclude='*.a' --exclude='*.prl' --exclude='*.qmltypes' " + macx-xcode: QMAKE_POST_LINK += "$p/ $$qmlTargetPath; done" + else: QMAKE_POST_LINK += "\$\$p/ $$qmlTargetPath; done" } } } |