Commit 6706659b authored by Christian Kandeler's avatar Christian Kandeler
Browse files

qbs build: Introduce item QtcProduct.



QtcAutotest, QtcLibrary, QtcPlugin and QtcTool share quite a bit of
code, which is now factored out into this new item from which they all
derive.

Change-Id: Ic947a19e121f37d34968b29c94dd02648da1cd5b
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent 17485ae7
import qbs import qbs
import qbs.FileInfo import qbs.FileInfo
import QtcFunctions import QtcProduct
CppApplication { QtcProduct {
type: "application" type: "application"
Depends { name: "Qt.test" } Depends { name: "Qt.test" }
targetName: "tst_" + name.split(' ').join("") targetName: "tst_" + name.split(' ').join("")
...@@ -11,8 +11,6 @@ CppApplication { ...@@ -11,8 +11,6 @@ CppApplication {
destinationDirectory: buildDirectory + '/' destinationDirectory: buildDirectory + '/'
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory) + FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
cpp.cxxFlags: QtcFunctions.commonCxxFlags(qbs)
cpp.linkerFlags: QtcFunctions.commonLinkerFlags(qbs)
cpp.rpaths: [ cpp.rpaths: [
buildDirectory + '/' + project.ide_library_path, buildDirectory + '/' + project.ide_library_path,
buildDirectory + '/' + project.ide_library_path + "/..", // OSX buildDirectory + '/' + project.ide_library_path + "/..", // OSX
...@@ -20,16 +18,16 @@ CppApplication { ...@@ -20,16 +18,16 @@ CppApplication {
] ]
cpp.minimumOsxVersion: "10.7" cpp.minimumOsxVersion: "10.7"
Group {
fileTagsFilter: product.type
qbs.install: false
}
// The following would be conceptually right, but does not work currently as some autotests // The following would be conceptually right, but does not work currently as some autotests
// (e.g. extensionsystem) do not work when installed, because they want hardcoded // (e.g. extensionsystem) do not work when installed, because they want hardcoded
// absolute paths to resources in the build directory. // absolute paths to resources in the build directory.
// cpp.rpaths: qbs.targetOS.contains("osx") // cpp.rpaths: qbs.targetOS.contains("osx")
// ? ["@executable_path/.."] // ? ["@executable_path/.."]
// : ["$ORIGIN/../" + project.libDirName + "/qtcreator", // : ["$ORIGIN/../" + project.libDirName + "/qtcreator",
// "$ORIGIN/../" project.libDirName + "/qtcreator/plugins"] // "$ORIGIN/../" project.libDirName + "/qtcreator/plugins"]
// Group {
// fileTagsFilter: product.type
// qbs.install: true
// qbs.installDir: project.ide_bin_path
// }
} }
import qbs 1.0 import qbs 1.0
import QtcFunctions import QtcFunctions
import QtcProduct
DynamicLibrary { QtcProduct {
Depends { name: "cpp" } type: "dynamiclibrary"
installDir: project.ide_library_path
Depends { Depends {
condition: project.testsEnabled condition: project.testsEnabled
name: "Qt.test" name: "Qt.test"
...@@ -11,13 +13,9 @@ DynamicLibrary { ...@@ -11,13 +13,9 @@ DynamicLibrary {
targetName: QtcFunctions.qtLibraryName(qbs, name) targetName: QtcFunctions.qtLibraryName(qbs, name)
destinationDirectory: project.ide_library_path destinationDirectory: project.ide_library_path
cpp.defines: project.generalDefines
cpp.cxxFlags: QtcFunctions.commonCxxFlags(qbs)
cpp.linkerFlags: { cpp.linkerFlags: {
var flags = QtcFunctions.commonLinkerFlags(qbs); var flags = base;
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw"))) if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("-Wl,-s");
else if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
return flags; return flags;
} }
...@@ -27,17 +25,9 @@ DynamicLibrary { ...@@ -27,17 +25,9 @@ DynamicLibrary {
: ["$ORIGIN", "$ORIGIN/.."] : ["$ORIGIN", "$ORIGIN/.."]
property string libIncludeBase: ".." // #include <lib/header.h> property string libIncludeBase: ".." // #include <lib/header.h>
cpp.includePaths: [libIncludeBase] cpp.includePaths: [libIncludeBase]
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
Export { Export {
Depends { name: "cpp" } Depends { name: "cpp" }
cpp.includePaths: [libIncludeBase] cpp.includePaths: [libIncludeBase]
} }
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: project.ide_library_path
}
} }
import qbs 1.0 import qbs 1.0
import qbs.FileInfo import qbs.FileInfo
import QtcFunctions import QtcFunctions
import QtcProduct
Product { QtcProduct {
type: ["dynamiclibrary", "pluginSpec"] type: ["dynamiclibrary", "pluginSpec"]
installDir: project.ide_plugin_path
property var pluginspecreplacements property var pluginspecreplacements
property var pluginRecommends: [] property var pluginRecommends: []
Depends { name: "Qt.core" }
property string minimumQtVersion: "4.8" property string minimumQtVersion: "4.8"
condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion) condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion)
...@@ -16,30 +18,24 @@ Product { ...@@ -16,30 +18,24 @@ Product {
Depends { name: "ExtensionSystem" } Depends { name: "ExtensionSystem" }
Depends { name: "pluginspec" } Depends { name: "pluginspec" }
Depends { name: "cpp" }
Depends { Depends {
condition: project.testsEnabled condition: project.testsEnabled
name: "Qt.test" name: "Qt.test"
} }
cpp.defines: project.generalDefines.concat([name.toUpperCase() + "_LIBRARY"]) cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"])
cpp.installNamePrefix: "@rpath/PlugIns/" cpp.installNamePrefix: "@rpath/PlugIns/"
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/..", "@executable_path/.."] cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/..", "@executable_path/.."]
: ["$ORIGIN", "$ORIGIN/.."] : ["$ORIGIN", "$ORIGIN/.."]
cpp.cxxFlags: QtcFunctions.commonCxxFlags(qbs)
cpp.linkerFlags: { cpp.linkerFlags: {
var flags = QtcFunctions.commonLinkerFlags(qbs); var flags = base;
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw"))) if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("-Wl,-s");
else if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
return flags; return flags;
} }
property string pluginIncludeBase: ".." // #include <plugin/header.h> property string pluginIncludeBase: ".." // #include <plugin/header.h>
cpp.includePaths: [pluginIncludeBase] cpp.includePaths: [pluginIncludeBase]
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
Group { Group {
name: "PluginSpec" name: "PluginSpec"
...@@ -52,12 +48,6 @@ Product { ...@@ -52,12 +48,6 @@ Product {
files: [ "*.mimetypes.xml" ] files: [ "*.mimetypes.xml" ]
} }
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: project.ide_plugin_path
}
Export { Export {
Depends { name: "ExtensionSystem" } Depends { name: "ExtensionSystem" }
Depends { name: "cpp" } Depends { name: "cpp" }
......
import qbs 1.0
import QtcFunctions
Product {
property string installDir
Depends { name: "cpp" }
cpp.defines: project.generalDefines
cpp.cxxFlags: QtcFunctions.commonCxxFlags(qbs)
cpp.linkerFlags: {
var flags = QtcFunctions.commonLinkerFlags(qbs);
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
flags.push("-Wl,-s");
return flags;
}
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
Depends { name: "Qt.core" }
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: installDir
}
}
import qbs 1.0 import qbs 1.0
import QtcFunctions import QtcProduct
Application { QtcProduct {
type: "application" // no Mac app bundle type: "application" // no Mac app bundle
Depends { name: "cpp" } installDir: project.ide_libexec_path
cpp.defines: project.generalDefines
cpp.cxxFlags: QtcFunctions.commonCxxFlags(qbs)
cpp.linkerFlags: {
var flags = QtcFunctions.commonLinkerFlags(qbs);
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
flags.push("-Wl,-s");
return flags;
}
property string toolInstallDir: project.ide_libexec_path
cpp.rpaths: qbs.targetOS.contains("osx") cpp.rpaths: qbs.targetOS.contains("osx")
? ["@executable_path/../" + project.ide_library_path] ? ["@executable_path/../" + project.ide_library_path]
: ["$ORIGIN/../" + project.ide_library_path] : ["$ORIGIN/../" + project.ide_library_path]
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: toolInstallDir
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment