summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qml_module.prf
blob: 2115b39c0448b8d7c3d93f50f8eb9c571a5d0031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
#  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 = $$qmldir_file

for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)

# Only for Qt Creator's project view
OTHER_FILES += $$fq_qml_files

qml1_target: \
    instbase = $$[QT_INSTALL_IMPORTS]
else: \
    instbase = $$[QT_INSTALL_QML]

!qml1_target:static: CONFIG += builtin_resources

!force_independent:if(!debug_and_release|!build_all|CONFIG(release, debug|release)) {
    # These bizarre rules copy the files to the qtbase build directory

    defineReplace(qmlModStripSrcDir) {
        return($$relative_path($$1, $$_PRO_FILE_PWD_))
    }

    !builtin_resources: qmlfiles2build.input = fq_qml_files
    else: qmlfiles2build.input = qmldir_file
    qmlfiles2build.output = $$instbase/$$TARGETPATH/${QMAKE_FUNC_FILE_IN_qmlModStripSrcDir}
    !contains(TEMPLATE, vc.*): qmlfiles2build.variable_out = PRE_TARGETDEPS
    qmlfiles2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
    qmlfiles2build.name = COPY ${QMAKE_FILE_IN}
    qmlfiles2build.CONFIG = no_link no_clean

    QMAKE_EXTRA_COMPILERS += qmlfiles2build
}

builtin_resources {
    URITARGET = $$replace(URI, "\\.", "_")
    # 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_
!builtin_resources: qmldir.files = $$fq_qml_files
else: qmldir.files = $$qmldir_file
qmldir.path = $$instbase/$$TARGETPATH
INSTALLS += qmldir