aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/bundledqt/bundledqt.qbs
blob: 6e9b744ab01efaf9fc1a736c63f7f57e5a59bb6a (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
import qbs
import qbs.FileInfo

Product {
    Depends { name: "qbsbuildconfig" }
    Depends { name: "Qt"; submodules:
            ["core", "gui", "network", "printsupport", "widgets", "xml"] }
    Depends { name: "Qt.script"; required: false }

    property bool deployQt: qbsbuildconfig.enableBundledQt && qbs.targetOS.contains("macos")
                            && Qt.core.qtConfig.contains("rpath")
    property bool deployDebugLibraries: qbs.buildVariant === "debug"
        || (qbs.buildVariants && qbs.buildVariants.contains("debug"))

    readonly property string qtDebugLibrarySuffix: {
        if (qbs.targetOS.contains("windows"))
            return "d";
        if (qbs.targetOS.contains("darwin"))
            return "_debug";
        return "";
    }

    Group {
        condition: deployQt && !Qt.core.staticBuild
        name: "qt.conf"
        files: ["qt.conf"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.appInstallDir
    }

    Group {
        condition: deployQt
        name: "Qt libraries"
        files: !Qt.core.staticBuild ? Array.prototype.concat.apply(
                                          [], Object.getOwnPropertyNames(Qt).map(function(mod) {
            if (mod === "script" && !Qt[mod].present)
                return [];
            if (!Qt[mod].hasLibrary)
                return [];
            var fp = Qt[mod].libFilePathRelease;
            var fpd = Qt.core.frameworkBuild ? fp + qtDebugLibrarySuffix : Qt[mod].libFilePathDebug;

            var list = [fp];
            if (deployDebugLibraries && qtDebugLibrarySuffix)
                list.push(fpd);

            if (Qt.core.frameworkBuild) {
                var suffix = ".framework/";
                var frameworkPath = fp.substr(0, fp.lastIndexOf(suffix) + suffix.length - 1);
                var versionsPath = frameworkPath + "/Versions";
                var versionPath = versionsPath + "/" + Qt.core.versionMajor;
                list.push(frameworkPath + "/Resources");
                list.push(versionPath + "/Resources/Info.plist");
                list.push(versionPath + "/" + FileInfo.fileName(fp));
                if (deployDebugLibraries && qtDebugLibrarySuffix)
                    list.push(versionPath + "/" + FileInfo.fileName(fpd));
                if (qbsbuildconfig.installApiHeaders) {
                    list.push(frameworkPath + "/Headers");
                    list.push(versionPath + "/Headers/**");
                }
            }

            return list;
        })) : []
        qbs.install: true
        qbs.installDir: qbsbuildconfig.libInstallDir
        qbs.installSourceBase: Qt.core.libPath
    }

    Group {
        condition: deployQt
        prefix: Qt.core.pluginPath + "/"
        name: "QPA plugin"
        files: !Qt.core.staticBuild ? Array.prototype.concat.apply([], [""].concat(
                    deployDebugLibraries && qtDebugLibrarySuffix ? [qtDebugLibrarySuffix] : []).map(
                                                function(suffix) {
            return ["platforms/" + cpp.dynamicLibraryPrefix + (Qt.gui.defaultQpaPlugin || "qcocoa")
                    + suffix + cpp.dynamicLibrarySuffix];
        })) : []
        qbs.install: true
        qbs.installDir: "plugins"
        qbs.installSourceBase: prefix
    }
}