qtcreator.qbs 3.99 KB
Newer Older
1
import qbs 1.0
2
import qbs.Environment
3
import qbs.FileInfo
Joerg Bornemann's avatar
Joerg Bornemann committed
4 5

Project {
6
    name: "Qt Creator"
7
    minimumQbsVersion: "1.4.3"
8
    property bool withAutotests: qbs.buildVariant === "debug"
Eike Ziller's avatar
Eike Ziller committed
9 10
    property string ide_version_major: '4'
    property string ide_version_minor: '0'
Eike Ziller's avatar
Eike Ziller committed
11
    property string ide_version_release: '82'
Joerg Bornemann's avatar
Joerg Bornemann committed
12
    property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
Eike Ziller's avatar
Eike Ziller committed
13 14
    property string ide_compat_version_major: '4'
    property string ide_compat_version_minor: '0'
Eike Ziller's avatar
Eike Ziller committed
15
    property string ide_compat_version_release: '82'
Eike Ziller's avatar
Eike Ziller committed
16
    property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release
17
    property path ide_source_tree: path
Joerg Bornemann's avatar
Joerg Bornemann committed
18 19
    property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
    property string ide_app_target: qbs.targetOS.contains("osx") ? "Qt Creator" : "qtcreator"
20 21 22
    property pathList additionalPlugins: []
    property pathList additionalLibs: []
    property pathList additionalTools: []
23
    property pathList additionalAutotests: []
24
    property string sharedSourcesDir: path + "/src/shared"
25
    property string libDirName: "lib"
26
    property string ide_library_path: {
Joerg Bornemann's avatar
Joerg Bornemann committed
27
        if (qbs.targetOS.contains("osx"))
Eike Ziller's avatar
Eike Ziller committed
28
            return ide_app_target + ".app/Contents/Frameworks"
Joerg Bornemann's avatar
Joerg Bornemann committed
29
        else if (qbs.targetOS.contains("windows"))
30 31
            return ide_app_path
        else
32
            return libDirName + "/qtcreator"
33 34
    }
    property string ide_plugin_path: {
Joerg Bornemann's avatar
Joerg Bornemann committed
35
        if (qbs.targetOS.contains("osx"))
Eike Ziller's avatar
Eike Ziller committed
36
            return ide_app_target + ".app/Contents/PlugIns"
Joerg Bornemann's avatar
Joerg Bornemann committed
37
        else if (qbs.targetOS.contains("windows"))
38
            return libDirName + "/qtcreator/plugins"
39 40 41
        else
            return ide_library_path + "/plugins"
    }
Joerg Bornemann's avatar
Joerg Bornemann committed
42
    property string ide_data_path: qbs.targetOS.contains("osx")
Joerg Bornemann's avatar
Joerg Bornemann committed
43 44
            ? ide_app_target + ".app/Contents/Resources"
            : "share/qtcreator"
Joerg Bornemann's avatar
Joerg Bornemann committed
45
    property string ide_libexec_path: qbs.targetOS.contains("osx")
46 47 48
            ? ide_data_path : qbs.targetOS.contains("windows")
            ? ide_app_path
            : "libexec/qtcreator"
Joerg Bornemann's avatar
Joerg Bornemann committed
49
    property string ide_doc_path: qbs.targetOS.contains("osx")
Joerg Bornemann's avatar
Joerg Bornemann committed
50 51
            ? ide_data_path + "/doc"
            : "share/doc/qtcreator"
Joerg Bornemann's avatar
Joerg Bornemann committed
52
    property string ide_bin_path: qbs.targetOS.contains("osx")
Joerg Bornemann's avatar
Joerg Bornemann committed
53 54
            ? ide_app_target + ".app/Contents/MacOS"
            : ide_app_path
55
    property bool testsEnabled: Environment.getEnv("TEST") || qbs.buildVariant === "debug"
56 57
    property stringList generalDefines: [
        "QT_CREATOR",
58
        'IDE_LIBRARY_BASENAME="' + libDirName + '"',
59
        "QT_NO_CAST_TO_ASCII",
60
        "QT_RESTRICTED_CAST_FROM_ASCII"
61
    ].concat(testsEnabled ? ["WITH_TESTS"] : [])
62
    qbsSearchPaths: "qbs"
Joerg Bornemann's avatar
Joerg Bornemann committed
63 64

    references: [
65
        "src/src.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
66
        "share/share.qbs",
67
        "share/qtcreator/translations/translations.qbs",
68
        "tests/tests.qbs"
Joerg Bornemann's avatar
Joerg Bornemann committed
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
    AutotestRunner {
        Depends { name: "Qt.core" }
        environment: {
            var env = base;
            if (!qbs.hostOS.contains("windows") || !qbs.targetOS.contains("windows"))
                return env;
            var path = "";
            for (var i = 0; i < env.length; ++i) {
                if (env[i].startsWith("PATH=")) {
                    path = env[i].substring(5);
                    break;
                }
            }
            var fullQtcInstallDir
                    = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, qbs.InstallDir);
            var fullLibInstallDir = FileInfo.joinPaths(fullQtcInstallDir, project.ide_library_path);
            var fullPluginInstallDir
                    = FileInfo.joinPaths(fullQtcInstallDir, project.ide_plugin_path);
            path = Qt.core.binPath + ";" + fullLibInstallDir + ";" + fullPluginInstallDir
                    + ";" + path;
            var arrayElem = "PATH=" + path;
            if (i < env.length)
                env[i] = arrayElem;
            else
                env.push(arrayElem);
            return env;
        }
    }
Joerg Bornemann's avatar
Joerg Bornemann committed
99
}