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

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.FileInfo
import QtcFunctions
import QtcProduct
CppApplication {
QtcProduct {
type: "application"
Depends { name: "Qt.test" }
targetName: "tst_" + name.split(' ').join("")
......@@ -11,8 +11,6 @@ CppApplication {
destinationDirectory: buildDirectory + '/'
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
cpp.cxxFlags: QtcFunctions.commonCxxFlags(qbs)
cpp.linkerFlags: QtcFunctions.commonLinkerFlags(qbs)
cpp.rpaths: [
buildDirectory + '/' + project.ide_library_path,
buildDirectory + '/' + project.ide_library_path + "/..", // OSX
......@@ -20,16 +18,16 @@ CppApplication {
]
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
// (e.g. extensionsystem) do not work when installed, because they want hardcoded
// absolute paths to resources in the build directory.
// cpp.rpaths: qbs.targetOS.contains("osx")
// ? ["@executable_path/.."]
// : ["$ORIGIN/../" + project.libDirName + "/qtcreator",
// "$ORIGIN/../" project.libDirName + "/qtcreator/plugins"]
// Group {
// fileTagsFilter: product.type
// qbs.install: true
// qbs.installDir: project.ide_bin_path
// }
// cpp.rpaths: qbs.targetOS.contains("osx")
// ? ["@executable_path/.."]
// : ["$ORIGIN/../" + project.libDirName + "/qtcreator",
// "$ORIGIN/../" project.libDirName + "/qtcreator/plugins"]
}
import qbs 1.0
import QtcFunctions
import QtcProduct
DynamicLibrary {
Depends { name: "cpp" }
QtcProduct {
type: "dynamiclibrary"
installDir: project.ide_library_path
Depends {
condition: project.testsEnabled
name: "Qt.test"
......@@ -11,13 +13,9 @@ DynamicLibrary {
targetName: QtcFunctions.qtLibraryName(qbs, name)
destinationDirectory: project.ide_library_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");
else if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
var flags = base;
if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
return flags;
}
......@@ -27,17 +25,9 @@ DynamicLibrary {
: ["$ORIGIN", "$ORIGIN/.."]
property string libIncludeBase: ".." // #include <lib/header.h>
cpp.includePaths: [libIncludeBase]
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
Export {
Depends { name: "cpp" }
cpp.includePaths: [libIncludeBase]
}
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: project.ide_library_path
}
}
import qbs 1.0
import qbs.FileInfo
import QtcFunctions
import QtcProduct
Product {
QtcProduct {
type: ["dynamiclibrary", "pluginSpec"]
installDir: project.ide_plugin_path
property var pluginspecreplacements
property var pluginRecommends: []
Depends { name: "Qt.core" }
property string minimumQtVersion: "4.8"
condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion)
......@@ -16,30 +18,24 @@ Product {
Depends { name: "ExtensionSystem" }
Depends { name: "pluginspec" }
Depends { name: "cpp" }
Depends {
condition: project.testsEnabled
name: "Qt.test"
}
cpp.defines: project.generalDefines.concat([name.toUpperCase() + "_LIBRARY"])
cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"])
cpp.installNamePrefix: "@rpath/PlugIns/"
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/..", "@executable_path/.."]
: ["$ORIGIN", "$ORIGIN/.."]
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");
else if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
var flags = base;
if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
return flags;
}
property string pluginIncludeBase: ".." // #include <plugin/header.h>
cpp.includePaths: [pluginIncludeBase]
cpp.minimumOsxVersion: "10.7"
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
Group {
name: "PluginSpec"
......@@ -52,12 +48,6 @@ Product {
files: [ "*.mimetypes.xml" ]
}
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: project.ide_plugin_path
}
Export {
Depends { name: "ExtensionSystem" }
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 QtcFunctions
import QtcProduct
Application {
QtcProduct {
type: "application" // no Mac app bundle
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;
}
property string toolInstallDir: project.ide_libexec_path
installDir: project.ide_libexec_path
cpp.rpaths: qbs.targetOS.contains("osx")
? ["@executable_path/../" + 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