qt5base-lts/mkspecs/features/qml_module.prf
J-P Nurmi 9c4295978e qml_module.prf: add 'install_qml_files' config
Allow QML modules to request installing QML files on the file system
regardless of whether the QML files are embedded to resources.

Qt Quick Controls need both; external QML files, that are prioritized
over compiled resources, can be left out from the final deployment
package.

The desired setup can be configured as follows:

    CONFIG += install_qml_files builtin_resources qtquickcompiler

With this, there is no need to write custom install/copy/qrc rules
for QML files.

Change-Id: I2ff2974b64efaea341b6ebb4c9fc2612497d7a33
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-04-05 08:38:16 +00:00

69 lines
2.0 KiB
Plaintext

#
# W A R N I N G
# -------------
#
# This file is not part of the Qt API. It exists purely as an
# implementation detail. It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#
equals(TEMPLATE, app): TEMPLATE = aux
isEmpty(TARGETPATH): error("Must set TARGETPATH (QML import name)")
qmldir_file = $$_PRO_FILE_PWD_/qmldir
fq_qml_files =
for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
fq_aux_qml_files =
for(qmlf, AUX_QML_FILES): fq_aux_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
load(qt_build_paths)
qml1_target {
DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
instbase = $$[QT_INSTALL_IMPORTS]
} else {
DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
instbase = $$[QT_INSTALL_QML]
}
!qml1_target:static: \
CONFIG += builtin_resources
else: \
CONFIG += install_qml_files
builtin_resources {
URITARGET = $$replace(URI, "\\.", "_")
# In static builds, the QML engine reads also the qmldir file from the resources.
static: $${URITARGET}.files = $$qmldir_file
# Ensure the QML files are included in the resources.
$${URITARGET}.files += $$fq_qml_files
# qt-project.org/imports is the path used for locating imports inside the resources
$${URITARGET}.prefix = /qt-project.org/imports/$$TARGETPATH
RESOURCES += $${URITARGET}
}
# Install rules
qmldir.base = $$_PRO_FILE_PWD_
# Tools need qmldir and plugins.qmltypes always installed on the file system
qmldir.files = $$qmldir_file $$fq_aux_qml_files
install_qml_files: qmldir.files += $$fq_qml_files
qmldir.path = $$instbase/$$TARGETPATH
INSTALLS += qmldir
!debug_and_release|!build_all|CONFIG(release, debug|release) {
!prefix_build {
COPIES += qmldir
} else {
# For non-installed static builds, tools need qmldir and plugins.qmltypes
# files in the build dir
qmldir2build.files = $$qmldir_file $$fq_aux_qml_files
qmldir2build.path = $$DESTDIR
COPIES += qmldir2build
}
}