summaryrefslogtreecommitdiffstats
path: root/qt3dstudio.pro
blob: 47625ccb121f0b03db4a32956e8f1bff19bd9a41 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
requires(!ios)
requires(!winrt)
requires(!tvos)
requires(!watchos)
requires(!win32-msvc2013)

requires(qtHaveModule(widgets))
requires(qtHaveModule(multimedia))
requires(qtHaveModule(quick))
requires(qtHaveModule(qml))
requires(qtHaveModule(opengl))

SUBDIRS += \
    doc

load(qt_parts)

# 'deployqt' target can be used to automatically copy necessary Qt libraries needed by studio
# applications. DEPLOY_DIR environment variable must point to the directory where
# Qt3DStudio and Qt3DViewer executables/application bundles are installed to.
# The required Qt libraries are copied into that directory/bundles.
!build_pass|!debug_and_release {
    !mingw:win32|macos {
        macos {
            deploytool = macdeployqt
            exesuffix = .app
        } else:win32 {
            deploytool = windeployqt
            exesuffix = .exe

            # windeployqt will get confused when deploying viewer 1.0, because some of studio
            # libraries it links detect as Qt libraries due to their naming scheme.
            # Since viewer and studio have mostly identical Qt dependencies and both are deployed
            # to the same directory, we can just omit deployment of viewer in windows and
            # deploy the missing qml bits separately.

            # Viewer 1.0 needs the studio qml plugin
            # The assumption is that we are deploying release build in case both are built
            release {
                QML_FILE_R = QtStudio3D/declarative_qtstudio3d.dll
                QMAKE_EXTRA_TARGETS += deployReleaseQml
                deployTarget.depends += deployReleaseQml
                deployReleaseQml.depends = mkStudioQmlDir
                deployReleaseQml.commands = \
                    $$QMAKE_COPY $$shell_quote($$shell_path($$OUT_PWD/qml/$$QML_FILE_R)) \
                    $$shell_quote($$shell_path(\$(DEPLOY_DIR)/$$QML_FILE_R))
            } else {
                QML_FILE_D = QtStudio3D/declarative_qtstudio3dd.dll
                QMAKE_EXTRA_TARGETS += deployDebugQml
                deployTarget.depends += deployDebugQml
                deployDebugQml.depends += mkStudioQmlDir
                deployDebugQml.commands = \
                    $$QMAKE_COPY $$shell_quote($$shell_path($$OUT_PWD/qml/$$QML_FILE_D)) \
                    $$shell_quote($$shell_path(\$(DEPLOY_DIR)/$$QML_FILE_D))
            }
            QMLDIR_FILE = QtStudio3D/qmldir
            QMAKE_EXTRA_TARGETS += deployQmldir
            deployTarget.depends += deployQmldir
            deployQmldir.depends += mkStudioQmlDir
            deployQmldir.commands = \
                $$QMAKE_COPY $$shell_quote($$shell_path($$OUT_PWD/qml/$$QMLDIR_FILE)) \
                $$shell_quote($$shell_path(\$(DEPLOY_DIR)/$$QMLDIR_FILE))

            QMAKE_EXTRA_TARGETS += mkStudioQmlDir
            mkStudioQmlDir.commands = \
                $$sprintf($$QMAKE_MKDIR_CMD, $$shell_quote($$shell_path(\$(DEPLOY_DIR)/QtStudio3D)))

            # Deploy viewer 1.0 qml dependencies when deploying studio
            EXTRA_DEPLOY_OPTIONS = -qmldir=$$shell_quote($$PWD/src/Viewer/Qt3DViewer)
        }

        qtPrepareTool(DEPLOY_TOOL, $$deploytool)

        deployTarget.commands = \
            $$DEPLOY_TOOL $$shell_quote(\$(DEPLOY_DIR)/Qt3DStudio$${exesuffix}) \
                -qmldir=$$shell_quote($$PWD/src/Authoring/Studio/Palettes) $$EXTRA_DEPLOY_OPTIONS

        macos {
            # Viewer 1.0
            deployTarget.commands += && \
                $$DEPLOY_TOOL $$shell_quote(\$(DEPLOY_DIR)/Qt3DViewer$${exesuffix}) \
                -qmldir=$$shell_quote($$PWD/src/Viewer/Qt3DViewer)
        }

        greaterThan(QT_MAJOR_VERSION, 5)|greaterThan(QT_MINOR_VERSION, 10) {
            # Viewer 2.0
            win32 {
                # Viewer 2.0 has similar issues with dependent library naming as viewer 1.0,
                # but it only has one library that is causing problems and no qml (so far),
                # so lets just copy the problem lib over to where windeployqt can find it,
                # i.e. under Qt's bin dir. This pollutes the Qt's bin dir a bit, but as the main
                # use case for this is gathering installer content in CI after everything is
                # already built, this shouldn't be a problem.
                release {
                    RUNTIME2_LIB = Qt53DStudioRuntime2.dll
                } else {
                    RUNTIME2_LIB = Qt53DStudioRuntime2d.dll
                }
                QMAKE_EXTRA_TARGETS += copyRuntime2
                deployTarget.depends += copyRuntime2
                copyRuntime2.commands = \
                    $$QMAKE_COPY $$shell_quote($$shell_path( \
                        $$OUT_PWD/src/Runtime/qt3d-runtime/bin/$$RUNTIME2_LIB)) \
                    $$shell_quote($$shell_path($$[QT_INSTALL_BINS]/$$RUNTIME2_LIB))
            }
            deployTarget.commands += && \
                $$DEPLOY_TOOL $$shell_quote(\$(DEPLOY_DIR)/q3dsviewer$${exesuffix})
        }
    } else {
        # Create a dummy target for other platforms
        deployTarget.commands = @echo deployqt target is not supported for this platform.
    }
    deployTarget.target = deployqt
    QMAKE_EXTRA_TARGETS += deployTarget
}