qtcreator.qbp 7.58 KB
Newer Older
Joerg Bornemann's avatar
Joerg Bornemann committed
1 2 3 4 5
import qbs.base 1.0
import qbs.fileinfo 1.0 as FileInfo

Project {
    property string ide_version_major: '2'
Christian Kandeler's avatar
Christian Kandeler committed
6 7
    property string ide_version_minor: '5'
    property string ide_version_release: '81'
Joerg Bornemann's avatar
Joerg Bornemann committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
    property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
    property var additionalCppDefines: [ 'IDE_LIBRARY_BASENAME="lib"' ]
    moduleSearchPaths: "qbs"

    references: [
        "lib/qtcreator/qtcomponents/qtcomponents.qbs",
        "share/share.qbs",
        "src/libs/3rdparty/botan/botan.qbs",
        "src/libs/aggregation/aggregation.qbs",
        "src/libs/cplusplus/cplusplus.qbs",
        "src/libs/extensionsystem/extensionsystem.qbs",
        "src/libs/glsl/glsl.qbs",
        "src/libs/languageutils/languageutils.qbs",
        "src/libs/qmleditorwidgets/qmleditorwidgets.qbs",
        "src/libs/qmljs/qmljs.qbs",
23
        "src/libs/qmldebug/qmldebug.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
24
        "src/libs/qtcomponents/styleitem/styleitem.qbs",
25
        "src/libs/ssh/ssh.qbs",
Orgad Shaneh's avatar
Orgad Shaneh committed
26 27
        "src/libs/utils/process_stub.qbs",
        "src/libs/utils/process_ctrlc_stub.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
28
        "src/libs/utils/utils.qbs",
29
        "src/libs/zeroconf/zeroconf.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
30
        "src/plugins/analyzerbase/analyzerbase.qbs",
Daniel Teske's avatar
Daniel Teske committed
31
        "src/plugins/android/android.qbs",
32
        "src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
33 34 35 36
        "src/plugins/bazaar/bazaar.qbs",
        "src/plugins/bineditor/bineditor.qbs",
        "src/plugins/bookmarks/bookmarks.qbs",
        "src/plugins/classview/classview.qbs",
Orgad Shaneh's avatar
Orgad Shaneh committed
37
        "src/plugins/clearcase/clearcase.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
38 39
        "src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs",
        "src/plugins/coreplugin/coreplugin.qbs",
Yuchen Deng's avatar
Yuchen Deng committed
40
        "src/plugins/coreplugin/images/logo/logo.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
        "src/plugins/cpaster/cpaster.qbs",
        "src/plugins/cppeditor/cppeditor.qbs",
        "src/plugins/cpptools/cpptools.qbs",
        "src/plugins/cvs/cvs.qbs",
        "src/plugins/debugger/debugger.qbs",
        "src/plugins/designer/designer.qbs",
        "src/plugins/fakevim/fakevim.qbs",
        "src/plugins/find/find.qbs",
        "src/plugins/genericprojectmanager/genericprojectmanager.qbs",
        "src/plugins/git/git.qbs",
        "src/plugins/glsleditor/glsleditor.qbs",
        "src/plugins/helloworld/helloworld.qbs",
        "src/plugins/help/help.qbs",
        "src/plugins/imageviewer/imageviewer.qbs",
        "src/plugins/locator/locator.qbs",
        "src/plugins/macros/macros.qbs",
        "src/plugins/madde/madde.qbs",
        "src/plugins/mercurial/mercurial.qbs",
        "src/plugins/perforce/perforce.qbs",
        "src/plugins/projectexplorer/projectexplorer.qbs",
61
        "src/plugins/qmldesigner/qmldesigner.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
62 63 64 65 66 67 68 69 70 71 72
        "src/plugins/qmljseditor/qmljseditor.qbs",
        "src/plugins/qmljstools/qmljstools.qbs",
        "src/plugins/qmlprofiler/qmlprofiler.qbs",
        "src/plugins/qmlprojectmanager/qmlprojectmanager.qbs",
        "src/plugins/qt4projectmanager/qt4projectmanager.qbs",
        "src/plugins/qtsupport/qtsupport.qbs",
        "src/plugins/remotelinux/remotelinux.qbs",
        "src/plugins/resourceeditor/resourceeditor.qbs",
        "src/plugins/subversion/subversion.qbs",
        "src/plugins/tasklist/tasklist.qbs",
        "src/plugins/texteditor/texteditor.qbs",
Orgad Shaneh's avatar
Orgad Shaneh committed
73
        "src/plugins/todo/todo.qbs",
Joerg Bornemann's avatar
Joerg Bornemann committed
74 75 76
        "src/plugins/valgrind/valgrind.qbs",
        "src/plugins/vcsbase/vcsbase.qbs",
        "src/plugins/welcome/welcome.qbs",
77
        "src/share/share.qbs",
Orgad Shaneh's avatar
Orgad Shaneh committed
78
        "src/tools/qtcdebugger/qtcdebugger.qbs",
Orgad Shaneh's avatar
Orgad Shaneh committed
79
        "src/tools/qtpromaker/qtpromaker.qbs"
Joerg Bornemann's avatar
Joerg Bornemann committed
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
    ]

    Product {
        name: "app_version_header"
        type: "hpp"
        files: "src/app/app_version.h.in"
        property string ide_version_major: project.ide_version_major
        property string ide_version_minor: project.ide_version_minor
        property string ide_version_release: project.ide_version_release
        property string qtcreator_version: project.qtcreator_version

        Transformer {
            inputs: ["src/app/app_version.h.in"]
            Artifact {
                fileName: "app/app_version.h"
                fileTags: "hpp"
            }
            prepare: {
                var cmd = new JavaScriptCommand();
                cmd.description = "generating app_version.h";
                cmd.highlight = "codegen";
                cmd.qtcreator_version = product.qtcreator_version;
                cmd.ide_version_major = product.ide_version_major;
                cmd.ide_version_minor = product.ide_version_minor;
                cmd.ide_version_release = product.ide_version_release;
                cmd.onWindows = (product.modules.qbs.targetOS == "windows");
                cmd.sourceCode = function() {
                    var file = new TextFile(input.fileName);
                    var content = file.readAll();
                    // replace quoted quotes
Yuchen Deng's avatar
Yuchen Deng committed
110
                    content = content.replace(/\\\"/g, '"');
Joerg Bornemann's avatar
Joerg Bornemann committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
                    // replace Windows line endings
                    if (onWindows)
                        content = content.replace(/\r\n/g, "\n");
                    // replace the magic qmake incantations
                    content = content.replace(/(\n#define IDE_VERSION) .+\n/, "$1 " + qtcreator_version + "\n");
                    content = content.replace(/(\n#define IDE_VERSION_MAJOR) .+\n/, "$1 " + ide_version_major + "\n")
                    content = content.replace(/(\n#define IDE_VERSION_MINOR) .+\n/, "$1 " + ide_version_minor + "\n")
                    content = content.replace(/(\n#define IDE_VERSION_RELEASE) .+\n/, "$1 " + ide_version_release + "\n")
                    file = new TextFile(output.fileName, TextFile.WriteOnly);
                    file.truncate();
                    file.write(content);
                    file.close();
                }
                return cmd;
            }
        }
    }

    Product {
        name: "qtcreator"
        type: ["application", "installed_content"]
        destination: "bin"
133
        consoleApplication: qbs.debugInformation
Joerg Bornemann's avatar
Joerg Bornemann committed
134

135
        cpp.rpaths: ["$ORIGIN/../lib/qtcreator"]
Joerg Bornemann's avatar
Joerg Bornemann committed
136
        cpp.defines: project.additionalCppDefines
137 138 139 140
        cpp.linkerFlags: {
            if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
                return ["-Wl,-s"]
        }
Joerg Bornemann's avatar
Joerg Bornemann committed
141 142 143 144 145 146 147 148 149 150
        cpp.includePaths: [
            "src",
            "src/libs",
            "src/shared/qtsingleapplication",
            "src/shared/qtlockedfile",
            buildDirectory
        ]

        Depends { name: "app_version_header" }
        Depends { name: "cpp" }
151
        Depends { name: "Qt"; submodules: ["widgets", "network"] }
152 153
        Depends { name: "Utils" }
        Depends { name: "ExtensionSystem" }
Joerg Bornemann's avatar
Joerg Bornemann committed
154 155 156

        files: [
            "src/app/main.cpp",
157
            "src/app/qtcreator.rc",
Joerg Bornemann's avatar
Joerg Bornemann committed
158 159 160 161 162 163 164 165
            "src/shared/qtsingleapplication/qtsingleapplication.h",
            "src/shared/qtsingleapplication/qtsingleapplication.cpp",
            "src/shared/qtsingleapplication/qtlocalpeer.h",
            "src/shared/qtsingleapplication/qtlocalpeer.cpp",
            "src/shared/qtlockedfile/qtlockedfile.cpp"
        ]

        Group {
166
            condition: qbs.targetOS == "linux" || qbs.targetOS == "macx"
Joerg Bornemann's avatar
Joerg Bornemann committed
167 168
            files: "bin/qtcreator.sh"
            fileTags: "install"
169
            qbs.installDir: "bin"
Joerg Bornemann's avatar
Joerg Bornemann committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
        }

        Group {
           condition: qbs.targetOS == "linux" || qbs.targetOS == "macx"
           files: [
               "src/shared/qtlockedfile/qtlockedfile_unix.cpp"
           ]
        }

        Group {
           condition: qbs.targetOS == "windows"
           files: [
               "src/shared/qtlockedfile/qtlockedfile_win.cpp"
           ]
        }
    }
}