summaryrefslogtreecommitdiffstats
path: root/pkg.pri
blob: 642acdcea4e0de121bc06da3d301b791361fe845 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# This file is an interim measure until deployment becomes more clear for
# the Qt5 SDK and Qt3D.  Read this file in conjunction with the logic in
# qmlres.cpp.  Once Qt5 is stable and deployment is clear this will be
# removed.  Also check the README file.

package {
    # default install path for packaging qml resources - package case
    resource_dir = $$[QT_INSTALL_DATA]/qt3d/resources/$$CATEGORY/$${TARGET}
} else {
    # if we're not packaging, build all our demos/examples/etc and supporting files
    # into $BUILD_DIR/bin
    DESTDIR = ../../../bin

    # default install path for packaging qml resources - developer case
    resource_dir = $$DESTDIR/resources/$$CATEGORY/$${TARGET}
}

# package the binary wrapper that launches the QML
package {
    macx: resource_dir = $$[QT_INSTALL_DATA]/qt3d/$${TARGET}.app/Contents/Resources
    target.path = $$[QT_INSTALL_DATA]/qt3d
    INSTALLS += target
} else {
    macx: resource_dir = $$DESTDIR/$$QMAKE_BUNDLE/Contents/Resources/qml
}

#  The QML_INFRA_FILES and QML_MESHES_FILES are both about QML based
# applications, so we'll install them into QT_INSTALL_DATA instead of
# QT_INSTALL_BINS
# QML_INFRA_FILES is used by our quick3d demos and examples to indicate files
# that are part of the application and should be installed (e.g. qml files,
# images, meshes etc).
# This conditional serves two purposes:
# 1) Set up a qmake extra compiler to copy relevant QML files at build time
#    to allow for a normal "change, make, test" developement cycle
# 2) Set up appropriate install paths on the same files to use "make install"
#    for building packages
!isEmpty(QML_INFRA_FILES) {

    # rules to copy files from the *base level* of $$PWD/qml into the right place
    package {
        copyqmlinfra_install.files = $$QML_INFRA_FILES
        copyqmlinfra_install.path = $$resource_dir/qml
        INSTALLS += copyqmlinfra_install
        mt {
            copyqmlcontrol_install.files = info.json mt.qml $$ICON_FILE
            copyqmlcontrol_install.path = $$resource_dir
            INSTALLS += copyqmlcontrol_install
        }
    } else {
        # if we're not packaging, put all our demos/examples and supporting files
        # into $BUILD_DIR/bin
        target_dir = $$resource_dir/qml
        target_dir ~= s,/,$$QMAKE_DIR_SEP,
        # create extra qmake compiler to copy files across during build step
        copyqmlinfra.input = QML_INFRA_FILES
        copyqmlinfra.output = $$target_dir/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
        win32: isEmpty(QMAKE_SH) {
            # If we are in windows, and not a mingw shell, then the mkdir binary does not handle
            # the -p switch, and will fail if the directory already exists, so make it subject to
            # an "exists" test.  The parens are necessary otherwise the copy won't occur when the
            # test fails, since $$QMAKE_CHK_DIR_EXISTS is "IF NOT EXISTS"
            copyqmlinfra.commands = ($$QMAKE_CHK_DIR_EXISTS $$target_dir $$QMAKE_MKDIR $$target_dir) && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
        } else {
            # in mac, linux, and windows-with-mingw $$QMAKE_MKDIR has -p so this will always work
            copyqmlinfra.commands = $$QMAKE_MKDIR $$target_dir && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
        }
        copyqmlinfra.CONFIG += no_link_no_clean
        copyqmlinfra.variable_out = POST_TARGETDEPS
        QMAKE_EXTRA_COMPILERS += copyqmlinfra
    }
}

!isEmpty(QML_MESHES_FILES) {
    # rules to copy files from the *base level* of $$PWD/qml/meshes into the right place
    package {
        copyqmlmeshes_install.files = $$QML_MESHES_FILES
        copyqmlmeshes_install.path = $$resource_dir/qml/meshes
        INSTALLS += copyqmlmeshes_install
    } else {
        target_dir = $$resource_dir/qml/meshes
        target_dir ~= s,/,$$QMAKE_DIR_SEP,
        copyqmlmeshes.input = QML_MESHES_FILES
        copyqmlmeshes.output = $$target_dir/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
        win32: isEmpty(QMAKE_SH) {
            # If we are in windows, and not a mingw shell, then the mkdir binary does not handle
            # the -p switch, and will fail if the directory already exists, so make it subject to
            # an "exists" test.  The parens are necessary otherwise the copy won't occur when the
            # test fails, since $$QMAKE_CHK_DIR_EXISTS is "IF NOT EXISTS"
            copyqmlmeshes.commands = ($$QMAKE_CHK_DIR_EXISTS $$target_dir $$QMAKE_MKDIR $$target_dir) && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
        } else {
            # in mac, linux, and windows-with-mingw $$QMAKE_MKDIR has -p so this will always work
            copyqmlmeshes.commands = $$QMAKE_MKDIR $$target_dir && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
        }
        copyqmlmeshes.CONFIG += no_link_no_clean
        copyqmlmeshes.variable_out = POST_TARGETDEPS
        QMAKE_EXTRA_COMPILERS += copyqmlmeshes
    }
}