forked from qt-creator/qt-creator
Move some functions out of defaults.js and make them project properties.
The one that is left is the only one that's actually a function taking real input. This saves a number of includes. Change-Id: I77e777bbf6ed7ed4086f9a40de4dc3dd8c91a7af Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
@@ -1,22 +1,3 @@
|
||||
function testsEnabled(qbs)
|
||||
{
|
||||
return qbs.getenv("TEST") || qbs.buildVariant === "debug";
|
||||
}
|
||||
|
||||
function defines(qbs)
|
||||
{
|
||||
var list = [
|
||||
"QT_CREATOR",
|
||||
'IDE_LIBRARY_BASENAME="lib"',
|
||||
"QT_DISABLE_DEPRECATED_BEFORE=0x040900",
|
||||
"QT_NO_CAST_TO_ASCII",
|
||||
"QT_NO_CAST_FROM_ASCII"
|
||||
]
|
||||
if (testsEnabled(qbs))
|
||||
list.push("WITH_TESTS")
|
||||
return list
|
||||
}
|
||||
|
||||
// see PluginSpecPrivate::loadLibrary()
|
||||
function qtLibraryName(qbs, name)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,14 @@ Project {
|
||||
property string ide_bin_path: qbs.targetOS.contains("osx")
|
||||
? ide_app_target + ".app/Contents/MacOS"
|
||||
: ide_app_path
|
||||
property bool testsEnabled: qbs.getenv("TEST") || qbs.buildVariant === "debug"
|
||||
property stringList generalDefines: [
|
||||
"QT_CREATOR",
|
||||
'IDE_LIBRARY_BASENAME="lib"',
|
||||
"QT_DISABLE_DEPRECATED_BEFORE=0x040900",
|
||||
"QT_NO_CAST_TO_ASCII",
|
||||
"QT_NO_CAST_FROM_ASCII"
|
||||
].concat(testsEnabled ? ["WITH_TESTS"] : [])
|
||||
moduleSearchPaths: "qbs"
|
||||
|
||||
references: [
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import qbs
|
||||
import "../../qbs/defaults.js" as Defaults
|
||||
|
||||
Application {
|
||||
name: project.ide_app_target
|
||||
@@ -7,7 +6,7 @@ Application {
|
||||
|
||||
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/.."]
|
||||
: ["$ORIGIN/../lib/qtcreator"]
|
||||
cpp.defines: Defaults.defines(qbs)
|
||||
cpp.defines: project.generalDefines
|
||||
cpp.linkerFlags: {
|
||||
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
||||
return ["-Wl,-s"]
|
||||
|
||||
@@ -4,13 +4,13 @@ import "../../qbs/defaults.js" as Defaults
|
||||
DynamicLibrary {
|
||||
Depends { name: "cpp" }
|
||||
Depends {
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
name: "Qt.test"
|
||||
}
|
||||
|
||||
targetName: Defaults.qtLibraryName(qbs, name)
|
||||
|
||||
cpp.defines: Defaults.defines(qbs)
|
||||
cpp.defines: project.generalDefines
|
||||
cpp.linkerFlags: {
|
||||
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
||||
return ["-Wl,-s"]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import qbs.base 1.0
|
||||
import "../../../../qbs/defaults.js" as Defaults
|
||||
|
||||
DynamicLibrary {
|
||||
name: "styleplugin"
|
||||
@@ -7,7 +6,7 @@ DynamicLibrary {
|
||||
Depends { name: "cpp" }
|
||||
Depends { name: "Qt"; submodules: ["core", "widgets", "declarative", "script"] }
|
||||
|
||||
cpp.defines: Defaults.defines(qbs)
|
||||
cpp.defines: project.generalDefines
|
||||
|
||||
files: [
|
||||
"qdeclarativefolderlistmodel.cpp",
|
||||
|
||||
@@ -14,11 +14,11 @@ Product {
|
||||
Depends { name: "pluginspec" }
|
||||
Depends { name: "cpp" }
|
||||
Depends {
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
name: "Qt.test"
|
||||
}
|
||||
|
||||
cpp.defines: Defaults.defines(qbs).concat([name.toUpperCase() + "_LIBRARY"])
|
||||
cpp.defines: project.generalDefines.concat([name.toUpperCase() + "_LIBRARY"])
|
||||
cpp.installNamePrefix: "@rpath/PlugIns/" + provider + "/"
|
||||
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/../..", "@executable_path/.."]
|
||||
: ["$ORIGIN", "$ORIGIN/..", "$ORIGIN/../.."]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import qbs.base 1.0
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "Core"
|
||||
@@ -180,7 +179,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: [
|
||||
"testdatadir.cpp",
|
||||
"testdatadir.h"
|
||||
|
||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
||||
import qbs.FileInfo
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "CppEditor"
|
||||
@@ -55,7 +54,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: [
|
||||
"cppdoxygen_test.cpp",
|
||||
"cppquickfix_test.cpp",
|
||||
|
||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
||||
import qbs.FileInfo
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "CppTools"
|
||||
@@ -112,7 +111,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: [
|
||||
"cppcodegen_test.cpp",
|
||||
"cppcompletion_test.cpp",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import qbs.base 1.0
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "Debugger"
|
||||
@@ -26,7 +25,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
qbs.install: true
|
||||
qbs.installDir: "tests/manual/debugger/simple/"
|
||||
files: ["../../../tests/manual/debugger/simple/simple.pro"]
|
||||
|
||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
||||
import qbs.FileInfo
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "Designer"
|
||||
@@ -75,7 +74,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: [ "gotoslot_test.cpp" ]
|
||||
|
||||
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import qbs.base 1.0
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "FakeVim"
|
||||
@@ -23,7 +22,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: ["fakevim_test.cpp"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
||||
import qbs.FileInfo
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "Locator"
|
||||
@@ -49,7 +48,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: [
|
||||
"locatorfiltertest.cpp",
|
||||
"locatorfiltertest.h",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import qbs.base 1.0
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "ProjectExplorer"
|
||||
@@ -241,7 +240,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "WindowsToolChains"
|
||||
condition: qbs.targetOS.contains("windows") || Defaults.testsEnabled(qbs)
|
||||
condition: qbs.targetOS.contains("windows") || project.testsEnabled
|
||||
files: [
|
||||
"abstractmsvctoolchain.cpp",
|
||||
"abstractmsvctoolchain.h",
|
||||
@@ -258,7 +257,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: ["outputparser_test.h", "outputparser_test.cpp"]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import qbs.base 1.0
|
||||
|
||||
import "../QtcPlugin.qbs" as QtcPlugin
|
||||
import "../../../qbs/defaults.js" as Defaults
|
||||
|
||||
QtcPlugin {
|
||||
name: "QmlJSTools"
|
||||
@@ -73,7 +72,7 @@ QtcPlugin {
|
||||
|
||||
Group {
|
||||
name: "Tests"
|
||||
condition: Defaults.testsEnabled(qbs)
|
||||
condition: project.testsEnabled
|
||||
files: ["qmljstools_test.cpp"]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import qbs.base 1.0
|
||||
import "../../qbs/defaults.js" as Defaults
|
||||
|
||||
Application {
|
||||
type: "application" // no Mac app bundle
|
||||
Depends { name: "cpp" }
|
||||
cpp.defines: Defaults.defines(qbs)
|
||||
cpp.defines: project.generalDefines
|
||||
cpp.linkerFlags: {
|
||||
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
||||
return ["-Wl,-s"]
|
||||
|
||||
Reference in New Issue
Block a user