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

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

    references: [
64
        "src/src.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
65
        "share/share.qbs",
66
        "share/qtcreator/translations/translations.qbs",
67
        "tests/tests.qbs"
Joerg Bornemann's avatar
Joerg Bornemann committed
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
    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
98
}