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

    references: [
66
        "doc/doc.qbs",
67
        "src/src.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
68
        "share/share.qbs",
69
        "share/qtcreator/translations/translations.qbs",
70
        "tests/tests.qbs"
Joerg Bornemann's avatar
Joerg Bornemann committed
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
    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
101
}