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()
|
// see PluginSpecPrivate::loadLibrary()
|
||||||
function qtLibraryName(qbs, name)
|
function qtLibraryName(qbs, name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,14 @@ Project {
|
|||||||
property string ide_bin_path: qbs.targetOS.contains("osx")
|
property string ide_bin_path: qbs.targetOS.contains("osx")
|
||||||
? ide_app_target + ".app/Contents/MacOS"
|
? ide_app_target + ".app/Contents/MacOS"
|
||||||
: ide_app_path
|
: 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"
|
moduleSearchPaths: "qbs"
|
||||||
|
|
||||||
references: [
|
references: [
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import qbs
|
import qbs
|
||||||
import "../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
Application {
|
Application {
|
||||||
name: project.ide_app_target
|
name: project.ide_app_target
|
||||||
@@ -7,7 +6,7 @@ Application {
|
|||||||
|
|
||||||
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/.."]
|
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/.."]
|
||||||
: ["$ORIGIN/../lib/qtcreator"]
|
: ["$ORIGIN/../lib/qtcreator"]
|
||||||
cpp.defines: Defaults.defines(qbs)
|
cpp.defines: project.generalDefines
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
||||||
return ["-Wl,-s"]
|
return ["-Wl,-s"]
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import "../../qbs/defaults.js" as Defaults
|
|||||||
DynamicLibrary {
|
DynamicLibrary {
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
Depends {
|
Depends {
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
name: "Qt.test"
|
name: "Qt.test"
|
||||||
}
|
}
|
||||||
|
|
||||||
targetName: Defaults.qtLibraryName(qbs, name)
|
targetName: Defaults.qtLibraryName(qbs, name)
|
||||||
|
|
||||||
cpp.defines: Defaults.defines(qbs)
|
cpp.defines: project.generalDefines
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
||||||
return ["-Wl,-s"]
|
return ["-Wl,-s"]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
import "../../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
DynamicLibrary {
|
DynamicLibrary {
|
||||||
name: "styleplugin"
|
name: "styleplugin"
|
||||||
@@ -7,7 +6,7 @@ DynamicLibrary {
|
|||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
Depends { name: "Qt"; submodules: ["core", "widgets", "declarative", "script"] }
|
Depends { name: "Qt"; submodules: ["core", "widgets", "declarative", "script"] }
|
||||||
|
|
||||||
cpp.defines: Defaults.defines(qbs)
|
cpp.defines: project.generalDefines
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
"qdeclarativefolderlistmodel.cpp",
|
"qdeclarativefolderlistmodel.cpp",
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ Product {
|
|||||||
Depends { name: "pluginspec" }
|
Depends { name: "pluginspec" }
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
Depends {
|
Depends {
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
name: "Qt.test"
|
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.installNamePrefix: "@rpath/PlugIns/" + provider + "/"
|
||||||
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/../..", "@executable_path/.."]
|
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/../..", "@executable_path/.."]
|
||||||
: ["$ORIGIN", "$ORIGIN/..", "$ORIGIN/../.."]
|
: ["$ORIGIN", "$ORIGIN/..", "$ORIGIN/../.."]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "Core"
|
name: "Core"
|
||||||
@@ -180,7 +179,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: [
|
files: [
|
||||||
"testdatadir.cpp",
|
"testdatadir.cpp",
|
||||||
"testdatadir.h"
|
"testdatadir.h"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
|||||||
import qbs.FileInfo
|
import qbs.FileInfo
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "CppEditor"
|
name: "CppEditor"
|
||||||
@@ -55,7 +54,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: [
|
files: [
|
||||||
"cppdoxygen_test.cpp",
|
"cppdoxygen_test.cpp",
|
||||||
"cppquickfix_test.cpp",
|
"cppquickfix_test.cpp",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
|||||||
import qbs.FileInfo
|
import qbs.FileInfo
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "CppTools"
|
name: "CppTools"
|
||||||
@@ -112,7 +111,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: [
|
files: [
|
||||||
"cppcodegen_test.cpp",
|
"cppcodegen_test.cpp",
|
||||||
"cppcompletion_test.cpp",
|
"cppcompletion_test.cpp",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "Debugger"
|
name: "Debugger"
|
||||||
@@ -26,7 +25,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
qbs.install: true
|
qbs.install: true
|
||||||
qbs.installDir: "tests/manual/debugger/simple/"
|
qbs.installDir: "tests/manual/debugger/simple/"
|
||||||
files: ["../../../tests/manual/debugger/simple/simple.pro"]
|
files: ["../../../tests/manual/debugger/simple/simple.pro"]
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
|||||||
import qbs.FileInfo
|
import qbs.FileInfo
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "Designer"
|
name: "Designer"
|
||||||
@@ -75,7 +74,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: [ "gotoslot_test.cpp" ]
|
files: [ "gotoslot_test.cpp" ]
|
||||||
|
|
||||||
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
|
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "FakeVim"
|
name: "FakeVim"
|
||||||
@@ -23,7 +22,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: ["fakevim_test.cpp"]
|
files: ["fakevim_test.cpp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import qbs.base 1.0
|
|||||||
import qbs.FileInfo
|
import qbs.FileInfo
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "Locator"
|
name: "Locator"
|
||||||
@@ -49,7 +48,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: [
|
files: [
|
||||||
"locatorfiltertest.cpp",
|
"locatorfiltertest.cpp",
|
||||||
"locatorfiltertest.h",
|
"locatorfiltertest.h",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "ProjectExplorer"
|
name: "ProjectExplorer"
|
||||||
@@ -241,7 +240,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "WindowsToolChains"
|
name: "WindowsToolChains"
|
||||||
condition: qbs.targetOS.contains("windows") || Defaults.testsEnabled(qbs)
|
condition: qbs.targetOS.contains("windows") || project.testsEnabled
|
||||||
files: [
|
files: [
|
||||||
"abstractmsvctoolchain.cpp",
|
"abstractmsvctoolchain.cpp",
|
||||||
"abstractmsvctoolchain.h",
|
"abstractmsvctoolchain.h",
|
||||||
@@ -258,7 +257,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: ["outputparser_test.h", "outputparser_test.cpp"]
|
files: ["outputparser_test.h", "outputparser_test.cpp"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
import "../../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "QmlJSTools"
|
name: "QmlJSTools"
|
||||||
@@ -73,7 +72,7 @@ QtcPlugin {
|
|||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
condition: Defaults.testsEnabled(qbs)
|
condition: project.testsEnabled
|
||||||
files: ["qmljstools_test.cpp"]
|
files: ["qmljstools_test.cpp"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
import "../../qbs/defaults.js" as Defaults
|
|
||||||
|
|
||||||
Application {
|
Application {
|
||||||
type: "application" // no Mac app bundle
|
type: "application" // no Mac app bundle
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
cpp.defines: Defaults.defines(qbs)
|
cpp.defines: project.generalDefines
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
|
||||||
return ["-Wl,-s"]
|
return ["-Wl,-s"]
|
||||||
|
|||||||
Reference in New Issue
Block a user