summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qml_module.prf
blob: c0b50416c97c957d65b5f1048ccc964faac77ae2 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
#  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)")

!isEmpty(DYNAMIC_QMLDIR) {
    qmldir_path = $$OUT_PWD
    write_file($${qmldir_path}/qmldir, DYNAMIC_QMLDIR)|error("Aborting.")
} else {
    qmldir_path = $$_PRO_FILE_PWD_
}

qmldir_file = $${qmldir_path}/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)

DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH

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 = $$qmldir_path
qmldir.files = $$qmldir_file
qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH

qmlfiles.base = $$_PRO_FILE_PWD_
qmlfiles.files = $$fq_aux_qml_files
install_qml_files: qmlfiles.files += $$fq_qml_files
qmlfiles.path = $${qmldir.path}

INSTALL_QML_FILES = false

android {
    build_pass {
        isEmpty(ANDROID_ABIS): ANDROID_ABIS = $$ALL_ANDROID_ABIS
        ABI = $$first(ANDROID_ABIS)
        equals(ABI,  $$QT_ARCH): INSTALL_QML_FILES = true
    }
} else: !debug_and_release|!build_all|CONFIG(release, debug|release): INSTALL_QML_FILES = true

equals(INSTALL_QML_FILES, true) {
    INSTALLS += qmldir
    INSTALLS += qmlfiles

    !prefix_build {
        COPIES += qmldir qmlfiles
    } else {
        # For non-installed static builds, tools need qmldir and plugins.qmltypes
        # files in the build dir
        qml2build.files = $$qmldir_file $$fq_aux_qml_files
        qml2build.path = $$DESTDIR
        COPIES += qml2build
    }
}