aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'share/qbs/modules/cpp')
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs3
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs9
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs48
-rw-r--r--share/qbs/modules/cpp/LinuxGCC.qbs1
-rw-r--r--share/qbs/modules/cpp/UnixGCC.qbs1
-rw-r--r--share/qbs/modules/cpp/android-gcc.qbs92
-rw-r--r--share/qbs/modules/cpp/freebsd-gcc.qbs1
-rw-r--r--share/qbs/modules/cpp/gcc.js53
-rw-r--r--share/qbs/modules/cpp/ios-gcc.qbs1
-rw-r--r--share/qbs/modules/cpp/macos-gcc.qbs1
-rw-r--r--share/qbs/modules/cpp/msvc.js35
-rw-r--r--share/qbs/modules/cpp/qnx-qcc.qbs1
-rw-r--r--share/qbs/modules/cpp/tvos-gcc.qbs2
-rw-r--r--share/qbs/modules/cpp/watchos-gcc.qbs2
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs1
-rw-r--r--share/qbs/modules/cpp/windows-msvc.qbs25
16 files changed, 146 insertions, 130 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index c26be036d..01b0f8af9 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -178,6 +178,7 @@ Module {
property string debugInfoSuffix: ""
property string debugInfoBundleSuffix: ""
property string variantSuffix: ""
+ property string dynamicLibraryImportSuffix: ".lib"
property bool createSymlinks: true
property stringList dynamicLibraries // list of names, will be linked with -lname
property stringList staticLibraries // list of static library files
@@ -353,7 +354,7 @@ Module {
property stringList targetDriverFlags
property stringList targetLinkerFlags
- property bool _skipAllChecks: false // Internal, for testing only.
+ property bool _skipAllChecks: false // Internal
property bool validateTargetTriple: true
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index 16176b4eb..0bd294fb4 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs
import qbs.DarwinTools
import qbs.File
import qbs.FileInfo
@@ -50,7 +49,7 @@ UnixGCC {
id: lipoProbe
condition: !_skipAllChecks
names: [lipoName]
- platformPaths: {
+ platformSearchPaths: {
var paths = (xcode.present && xcode.devicePlatformPath)
? [xcode.devicePlatformPath + "/Developer/usr/bin"]
: [];
@@ -211,7 +210,8 @@ UnixGCC {
inputsFromDependencies: ["application"]
multiplex: true
- outputFileTags: ["bundle.input", "application", "primary", "debuginfo_app"]
+ outputFileTags: ["bundle.input", "application", "primary", "debuginfo_app",
+ "debuginfo_bundle", "bundle.variant_symlink", "debuginfo_plist"]
outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "application", "app")
prepare: Darwin.prepareLipo.apply(Darwin, arguments)
@@ -235,7 +235,8 @@ UnixGCC {
multiplex: true
outputFileTags: ["bundle.input", "dynamiclibrary", "dynamiclibrary_symbols", "primary",
- "debuginfo_dll"]
+ "debuginfo_dll","debuginfo_bundle","bundle.variant_symlink",
+ "debuginfo_plist"]
outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "dynamiclibrary", "dll")
prepare: Darwin.prepareLipo.apply(Darwin, arguments)
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 4e68dc267..972555ed7 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
@@ -389,7 +388,7 @@ CppModule {
|| product.multiplexConfigurationId
Rule {
- id: dynamicLibraryLinker
+ name: "dynamicLibraryLinker"
condition: product.cpp.shouldLink
multiplex: true
inputs: {
@@ -400,11 +399,12 @@ CppModule {
}
return tags;
}
- inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary"]
+ inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary", "dynamiclibrary_import"]
outputFileTags: [
"bundle.input",
- "dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_symbols", "debuginfo_dll"
+ "dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_symbols", "debuginfo_dll",
+ "debuginfo_bundle","dynamiclibrary_import", "debuginfo_plist",
]
outputArtifacts: {
var artifacts = [{
@@ -416,7 +416,14 @@ CppModule {
+ PathTools.bundleExecutableFilePath(product)
}
}];
- if (!product.qbs.toolchain.contains("mingw")) {
+ if (product.qbs.toolchain.contains("mingw")) {
+ artifacts.push({
+ fileTags: ["dynamiclibrary_import"],
+ filePath: FileInfo.joinPaths(product.destinationDirectory,
+ PathTools.importLibraryFilePath(product)),
+ alwaysUpdated: false
+ });
+ } else {
// List of libfoo's public symbols for smart re-linking.
artifacts.push({
filePath: product.destinationDirectory + "/.sosymbols/"
@@ -451,11 +458,11 @@ CppModule {
}
Rule {
- id: staticLibraryLinker
+ name: "staticLibraryLinker"
condition: product.cpp.shouldLink
multiplex: true
inputs: ["obj", "linkerscript"]
- inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary"]
+ inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
outputFileTags: ["bundle.input", "staticlibrary", "c_staticlibrary", "cpp_staticlibrary"]
outputArtifacts: {
@@ -487,13 +494,14 @@ CppModule {
var cmd = new Command(product.cpp.archiverPath, args);
cmd.description = 'creating ' + output.fileName;
cmd.highlight = 'linker'
+ cmd.jobPool = "linker";
cmd.responseFileUsagePrefix = '@';
return cmd;
}
}
Rule {
- id: loadableModuleLinker
+ name: "loadableModuleLinker"
condition: product.cpp.shouldLink
multiplex: true
inputs: {
@@ -504,9 +512,10 @@ CppModule {
}
return tags;
}
- inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary"]
+ inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
- outputFileTags: ["bundle.input", "loadablemodule", "debuginfo_loadablemodule"]
+ outputFileTags: ["bundle.input", "loadablemodule", "debuginfo_loadablemodule",
+ "debuginfo_bundle","debuginfo_plist"]
outputArtifacts: {
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
@@ -530,7 +539,7 @@ CppModule {
}
Rule {
- id: applicationLinker
+ name: "applicationLinker"
condition: product.cpp.shouldLink
multiplex: true
inputs: {
@@ -541,9 +550,10 @@ CppModule {
}
return tags;
}
- inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary"]
+ inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
- outputFileTags: ["bundle.input", "application", "debuginfo_app"]
+ outputFileTags: ["bundle.input", "application", "debuginfo_app","debuginfo_bundle",
+ "debuginfo_plist"]
outputArtifacts: {
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
@@ -566,14 +576,18 @@ CppModule {
}
Rule {
- id: compiler
+ name: "compiler"
inputs: ["cpp", "c", "objcpp", "objc", "asm_cpp"]
auxiliaryInputs: ["hpp"]
explicitlyDependsOn: ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"]
- outputFileTags: ["obj", "c_obj", "cpp_obj"]
+ outputFileTags: ["obj", "c_obj", "cpp_obj", "intermediate_obj"]
outputArtifacts: {
- var tags = ["obj"];
+ var tags;
+ if (input.fileTags.contains("cpp_intermediate_object"))
+ tags = ["intermediate_obj"];
+ else
+ tags = ["obj"];
if (inputs.c || inputs.objc)
tags.push("c_obj");
if (inputs.cpp || inputs.objcpp)
@@ -591,7 +605,7 @@ CppModule {
}
Rule {
- id: assembler
+ name: "assembler"
inputs: ["asm"]
Artifact {
diff --git a/share/qbs/modules/cpp/LinuxGCC.qbs b/share/qbs/modules/cpp/LinuxGCC.qbs
index 6af648c40..14fb0a7e9 100644
--- a/share/qbs/modules/cpp/LinuxGCC.qbs
+++ b/share/qbs/modules/cpp/LinuxGCC.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.Process
UnixGCC {
diff --git a/share/qbs/modules/cpp/UnixGCC.qbs b/share/qbs/modules/cpp/UnixGCC.qbs
index ec26cffb6..e5b99cd98 100644
--- a/share/qbs/modules/cpp/UnixGCC.qbs
+++ b/share/qbs/modules/cpp/UnixGCC.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.File
GenericGCC {
diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs
index b5dc367ee..e20f1e198 100644
--- a/share/qbs/modules/cpp/android-gcc.qbs
+++ b/share/qbs/modules/cpp/android-gcc.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
@@ -90,9 +89,18 @@ LinuxGCC {
Group {
name: "Android STL"
- condition: product.cpp.sharedStlFilePath
+ condition: product.cpp.sharedStlFilePath && product.cpp.shouldLink
files: product.cpp.sharedStlFilePath ? [product.cpp.sharedStlFilePath] : []
- fileTags: ["android.unstripped-stl"]
+ fileTags: "android.stl"
+ }
+
+ Group {
+ name: "gdbserver"
+ condition: qbs.buildVariant !== "release" && product.cpp.shouldLink
+ files: FileInfo.joinPaths(Android.ndk.ndkDir, "prebuilt",
+ "android-" + NdkUtils.abiNameToDirName(Android.ndk.abi),
+ "gdbserver", "gdbserver")
+ fileTags: "android.gdbserver"
}
toolchainInstallPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains",
@@ -222,82 +230,24 @@ LinuxGCC {
endianness: "little"
Rule {
- inputs: ["android.unstripped-stl"]
+ condition: shouldLink
+ inputs: "dynamiclibrary"
Artifact {
- filePath: FileInfo.joinPaths("stripped-libs", input.fileName);
- fileTags: ["android.stripped-stl"]
+ filePath: FileInfo.joinPaths("stripped-libs", input.fileName)
+ fileTags: "android.nativelibrary"
}
prepare: {
- var args = ["--strip-unneeded", "-o", output.filePath, input.filePath];
- var cmd = new Command(product.cpp.stripPath, args);
- cmd.description = "stripping " + input.fileName;
- return [cmd];
+ var stripArgs = ["--strip-unneeded", "-o", output.filePath, input.filePath];
+ var stripCmd = new Command(product.cpp.stripPath, stripArgs);
+ stripCmd.description = "Stripping unneeded symbols from " + input.fileName;
+ return stripCmd;
}
}
- Rule {
- inputs: ["dynamiclibrary"]
- explicitlyDependsOn: ["android.stripped-stl"];
- outputFileTags: ["android.nativelibrary", "android.gdbserver-info", "android.stl-info"]
- outputArtifacts: {
- var artifacts = [{
- filePath: FileInfo.joinPaths("stripped-libs",
- inputs["dynamiclibrary"][0].fileName),
- fileTags: ["android.nativelibrary"]
- }];
- if (product.moduleProperty("qbs", "buildVariant") === "debug") {
- artifacts.push({
- filePath: "android.gdbserver-info.txt",
- fileTags: ["android.gdbserver-info"]
- });
- }
- if (explicitlyDependsOn["android.stripped-stl"])
- artifacts.push({filePath: "android.stl-info.txt", fileTags: ["android.stl-info"]});
- return artifacts;
- }
-
- prepare: {
- var copyCmd = new JavaScriptCommand();
- copyCmd.silent = true;
- copyCmd.sourceCode = function() {
- File.copy(inputs["dynamiclibrary"][0].filePath,
- outputs["android.nativelibrary"][0].filePath);
- var arch = product.moduleProperty("Android.ndk", "abi");
- var destDir = FileInfo.joinPaths("lib", arch);
- if (product.moduleProperty("qbs", "buildVariant") === "debug") {
- arch = NdkUtils.abiNameToDirName(arch);
- var srcPath = FileInfo.joinPaths(
- product.moduleProperty("Android.ndk", "ndkDir"),
- "prebuilt/android-" + arch, "gdbserver/gdbserver");
- var targetPath = FileInfo.joinPaths(destDir,
- product.moduleProperty("Android.ndk", "gdbserverFileName"));
- var infoFile = new TextFile(outputs["android.gdbserver-info"][0].filePath,
- TextFile.WriteOnly);
- infoFile.writeLine(srcPath);
- infoFile.writeLine(targetPath);
- infoFile.close();
- }
- var strippedStlList = explicitlyDependsOn["android.stripped-stl"];
- if (strippedStlList) {
- var srcPath = strippedStlList[0].filePath;
- var targetPath = FileInfo.joinPaths(destDir, FileInfo.fileName(srcPath));
- var infoFile = new TextFile(outputs["android.stl-info"][0].filePath,
- TextFile.WriteOnly);
- infoFile.writeLine(srcPath);
- infoFile.writeLine(targetPath);
- infoFile.close();
- }
- }
- var stripArgs = ["--strip-unneeded", outputs["android.nativelibrary"][0].filePath];
- var stripCmd = new Command(product.moduleProperty("cpp", "stripPath"), stripArgs);
- stripCmd.description = "Stripping unneeded symbols from "
- + outputs["android.nativelibrary"][0].fileName;
- return [copyCmd, stripCmd];
- }
- }
+ _skipAllChecks: !shouldLink
validate: {
- if (!_skipAllChecks)
+ if (_skipAllChecks)
return;
var baseValidator = new ModUtils.PropertyValidator("qbs");
baseValidator.addCustomValidator("architecture", targetArch, function (value) {
diff --git a/share/qbs/modules/cpp/freebsd-gcc.qbs b/share/qbs/modules/cpp/freebsd-gcc.qbs
index 724f242ff..b5a4b89f3 100644
--- a/share/qbs/modules/cpp/freebsd-gcc.qbs
+++ b/share/qbs/modules/cpp/freebsd-gcc.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs
import "freebsd.js" as FreeBSD
UnixGCC {
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 452d7a4d1..7e25fa402 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -78,6 +78,8 @@ function collectLibraryDependencies(product, isDarwin) {
var publicDeps = {};
var objects = [];
var objectByFilePath = {};
+ var tagForLinkingAgainstSharedLib = product.qbs.toolchain.contains("mingw")
+ ? "dynamiclibrary_import" : "dynamiclibrary";
function addObject(obj, addFunc) {
addFunc.call(objects, obj);
@@ -151,7 +153,7 @@ function collectLibraryDependencies(product, isDarwin) {
var isStaticLibrary = typeof dep.artifacts["staticlibrary"] !== "undefined";
var isDynamicLibrary = !isStaticLibrary
- && typeof dep.artifacts["dynamiclibrary"] !== "undefined";
+ && typeof dep.artifacts[tagForLinkingAgainstSharedLib] !== "undefined";
if (!isStaticLibrary && !isDynamicLibrary)
return;
@@ -173,10 +175,10 @@ function collectLibraryDependencies(product, isDarwin) {
}
} else if (isDynamicLibrary) {
if (!isBelowIndirectDynamicLib) {
- addArtifactFilePaths(dep, "dynamiclibrary", addPublicFilePath);
+ addArtifactFilePaths(dep, tagForLinkingAgainstSharedLib, addPublicFilePath);
publicDeps[dep.name] = true;
} else {
- addArtifactFilePaths(dep, "dynamiclibrary", addPrivateFilePath);
+ addArtifactFilePaths(dep, tagForLinkingAgainstSharedLib, addPrivateFilePath);
}
}
}
@@ -245,7 +247,7 @@ function escapeLinkerFlags(product, inputs, linkerFlags) {
return linkerFlags;
}
-function linkerFlags(project, product, inputs, output, linkerPath) {
+function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath) {
var libraryPaths = product.cpp.libraryPaths;
var distributionLibraryPaths = product.cpp.distributionLibraryPaths;
var isDarwin = product.qbs.targetOS.contains("darwin");
@@ -261,7 +263,7 @@ function linkerFlags(project, product, inputs, output, linkerPath) {
var escapableLinkerFlags = [];
- if (output.fileTags.contains("dynamiclibrary")) {
+ if (primaryOutput.fileTags.contains("dynamiclibrary")) {
if (isDarwin) {
args.push((function () {
var tags = ["c", "cpp", "objc", "objcpp", "asm_cpp"];
@@ -279,16 +281,18 @@ function linkerFlags(project, product, inputs, output, linkerPath) {
var internalVersion = product.cpp.internalVersion;
if (internalVersion && isNumericProductVersion(internalVersion))
args.push("-current_version", internalVersion);
- escapableLinkerFlags.push("-install_name", UnixUtils.soname(product, output.fileName));
+ escapableLinkerFlags.push("-install_name", UnixUtils.soname(product,
+ primaryOutput.fileName));
} else {
- escapableLinkerFlags.push("-soname=" + UnixUtils.soname(product, output.fileName));
+ escapableLinkerFlags.push("-soname=" + UnixUtils.soname(product,
+ primaryOutput.fileName));
}
}
- if (output.fileTags.contains("loadablemodule"))
+ if (primaryOutput.fileTags.contains("loadablemodule"))
args.push(isDarwin ? "-bundle" : "-shared");
- if (output.fileTags.containsAny(["dynamiclibrary", "loadablemodule"])) {
+ if (primaryOutput.fileTags.containsAny(["dynamiclibrary", "loadablemodule"])) {
if (isDarwin)
escapableLinkerFlags.push("-headerpad_max_install_names");
else
@@ -414,7 +418,7 @@ function linkerFlags(project, product, inputs, output, linkerPath) {
// Note: due to the QCC response files hack in prepareLinker(), at least one object file or
// library file must follow the output file path so that QCC has something to process before
// sending the rest of the arguments through the response file.
- args.push("-o", output.filePath);
+ args.push("-o", primaryOutput.filePath);
if (inputs.obj)
args = args.concat(inputs.obj.map(function (obj) { return obj.filePath }));
@@ -501,6 +505,10 @@ function linkerFlags(project, product, inputs, output, linkerPath) {
}));
}
+ var importLibs = outputs.dynamiclibrary_import;
+ if (importLibs)
+ escapableLinkerFlags.push("--out-implib", importLibs[0].filePath);
+
var escapedLinkerFlags = escapeLinkerFlags(product, inputs, escapableLinkerFlags);
Array.prototype.push.apply(escapedLinkerFlags, args);
var driverLinkerFlags = useCompilerDriver ? product.cpp.driverLinkerFlags : undefined;
@@ -976,6 +984,7 @@ function prepareAssembler(project, product, inputs, outputs, input, output) {
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
+ cmd.jobPool = "assembler";
return cmd;
}
@@ -1035,7 +1044,25 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
var args = compilerFlags(project, product, input, output, explicitlyDependsOn);
var wrapperArgsLength = 0;
var wrapperArgs = product.cpp.compilerWrapper;
+ var extraEnv;
if (wrapperArgs && wrapperArgs.length > 0) {
+
+ // distcc cannot deal with absolute compiler paths (QBS-1336).
+ for (var i = 0; i < wrapperArgs.length; ++i) {
+ if (FileInfo.baseName(wrapperArgs[i]) !== "distcc")
+ continue;
+ if (i === wrapperArgs.length - 1) {
+ if (FileInfo.isAbsolutePath(compilerPath)) {
+ extraEnv = ["PATH=" + FileInfo.path(compilerPath)];
+ compilerPath = FileInfo.fileName(compilerPath);
+ }
+ } else if (FileInfo.isAbsolutePath(wrapperArgs[i + 1])) {
+ extraEnv = ["PATH=" + FileInfo.path(FileInfo.path(wrapperArgs[i + 1]))];
+ wrapperArgs[i + 1] = FileInfo.fileName(wrapperArgs[i + 1]);
+ }
+ break;
+ }
+
wrapperArgsLength = wrapperArgs.length;
args.unshift(compilerPath);
compilerPath = wrapperArgs.shift();
@@ -1047,7 +1074,10 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
if (pchOutput)
cmd.description += ' (' + compilerInfo.tag + ')';
cmd.highlight = "compiler";
+ cmd.jobPool = "compiler";
cmd.relevantEnvironmentVariables = compilerEnvVars(input, compilerInfo);
+ if (extraEnv)
+ cmd.environment = extraEnv;
cmd.responseFileArgumentIndex = wrapperArgsLength;
cmd.responseFileUsagePrefix = '@';
setResponseFileThreshold(cmd, product);
@@ -1240,7 +1270,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) {
var linkerPath = effectiveLinkerPath(product, inputs)
- var args = linkerFlags(project, product, inputs, primaryOutput, linkerPath);
+ var args = linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath);
var wrapperArgsLength = 0;
var wrapperArgs = product.cpp.linkerWrapper;
if (wrapperArgs && wrapperArgs.length > 0) {
@@ -1266,6 +1296,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) {
cmd = new Command(linkerPath, args);
cmd.description = 'linking ' + primaryOutput.fileName;
cmd.highlight = 'linker';
+ cmd.jobPool = "linker";
cmd.relevantEnvironmentVariables = linkerEnvVars(product, inputs);
cmd.responseFileArgumentIndex = responseFileArgumentIndex;
cmd.responseFileUsagePrefix = useQnxResponseFileHack ? "-Wl,@" : "@";
diff --git a/share/qbs/modules/cpp/ios-gcc.qbs b/share/qbs/modules/cpp/ios-gcc.qbs
index 408bc3aec..735766650 100644
--- a/share/qbs/modules/cpp/ios-gcc.qbs
+++ b/share/qbs/modules/cpp/ios-gcc.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.DarwinTools
import qbs.File
import qbs.FileInfo
diff --git a/share/qbs/modules/cpp/macos-gcc.qbs b/share/qbs/modules/cpp/macos-gcc.qbs
index e2c930c80..612b46ae8 100644
--- a/share/qbs/modules/cpp/macos-gcc.qbs
+++ b/share/qbs/modules/cpp/macos-gcc.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.ModUtils
import qbs.Utilities
diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js
index d6df99dc2..1864c40e1 100644
--- a/share/qbs/modules/cpp/msvc.js
+++ b/share/qbs/modules/cpp/msvc.js
@@ -188,7 +188,8 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
if (product.cpp.debugInformation && product.cpp.separateDebugInformation)
args.push("/Fd" + product.targetName + ".cl" + product.cpp.debugInfoSuffix);
- var objOutput = outputs.obj ? outputs.obj[0] : undefined
+ var objectMap = outputs.obj || outputs.intermediate_obj
+ var objOutput = objectMap ? objectMap[0] : undefined
args.push('/Fo' + FileInfo.toWindowsSeparators(objOutput.filePath))
args.push(FileInfo.toWindowsSeparators(input.filePath))
@@ -246,6 +247,7 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
if (pchOutput)
cmd.description += ' (' + tag + ')';
cmd.highlight = "compiler";
+ cmd.jobPool = "compiler";
cmd.workingDirectory = product.buildDirectory;
cmd.responseFileUsagePrefix = '@';
// cl.exe outputs the cpp file name. We filter that out.
@@ -261,8 +263,8 @@ function collectLibraryDependencies(product) {
var seen = {};
var result = [];
- function addFilePath(filePath, wholeArchive) {
- result.push({ filePath: filePath, wholeArchive: wholeArchive });
+ function addFilePath(filePath, wholeArchive, productName) {
+ result.push({ filePath: filePath, wholeArchive: wholeArchive, productName: productName });
}
function addArtifactFilePaths(dep, artifacts) {
@@ -270,8 +272,12 @@ function collectLibraryDependencies(product) {
return;
var artifactFilePaths = artifacts.map(function(a) { return a.filePath; });
var wholeArchive = dep.parameters.cpp && dep.parameters.cpp.linkWholeArchive;
- for (var i = 0; i < artifactFilePaths.length; ++i)
- addFilePath(artifactFilePaths[i], wholeArchive);
+ var artifactsAreImportLibs = artifacts.length > 0
+ && artifacts[0].fileTags.contains("dynamiclibrary_import");
+ for (var i = 0; i < artifactFilePaths.length; ++i) {
+ addFilePath(artifactFilePaths[i], wholeArchive,
+ artifactsAreImportLibs ? dep.name : undefined);
+ }
}
function addExternalLibs(obj) {
@@ -466,14 +472,31 @@ function prepareLinker(project, product, inputs, outputs, input, output) {
args = wrapperArgs.concat(args);
}
var commands = [];
+ var warningCmd = new JavaScriptCommand();
+ warningCmd.silent = true;
+ warningCmd.libDeps = libDeps;
+ warningCmd.sourceCode = function() {
+ for (var i = 0; i < libDeps.length; ++i) {
+ if (!libDeps[i].productName || File.exists(libDeps[i].filePath))
+ continue;
+ console.warn("Import library '" + FileInfo.toNativeSeparators(libDeps[i].filePath)
+ + "' does not exist. This typically happens when a DLL does not "
+ + "export any symbols. Please make sure the '" + libDeps[i].productName
+ + "' library exports symbols, or, if you do not intend to actually "
+ + "link against it, specify \"cpp.link: false\" in the Depends item.");
+ }
+ };
+ commands.push(warningCmd);
var cmd = new Command(linkerPath, args)
cmd.description = 'linking ' + primaryOutput.fileName;
cmd.highlight = 'linker';
+ cmd.jobPool = "linker";
cmd.relevantEnvironmentVariables = ["LINK", "_LINK_", "LIB", "TMP"];
cmd.workingDirectory = FileInfo.path(primaryOutput.filePath)
cmd.responseFileUsagePrefix = '@';
cmd.stdoutFilterFunction = function(output) {
- return output.replace(/^(.*performing full link.*\r\n)? +Creating library.*\r\n$/, "");
+ res = output.replace(/^.*performing full link.*\s*/, "");
+ return res.replace(/^ *Creating library.*\r\n$/, "");
};
commands.push(cmd);
diff --git a/share/qbs/modules/cpp/qnx-qcc.qbs b/share/qbs/modules/cpp/qnx-qcc.qbs
index 28c9ce266..a39a6a998 100644
--- a/share/qbs/modules/cpp/qnx-qcc.qbs
+++ b/share/qbs/modules/cpp/qnx-qcc.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs
import qbs.FileInfo
UnixGCC {
diff --git a/share/qbs/modules/cpp/tvos-gcc.qbs b/share/qbs/modules/cpp/tvos-gcc.qbs
index ae4dd5c5b..19bc9b787 100644
--- a/share/qbs/modules/cpp/tvos-gcc.qbs
+++ b/share/qbs/modules/cpp/tvos-gcc.qbs
@@ -28,8 +28,6 @@
**
****************************************************************************/
-import qbs
-
DarwinGCC {
priority: 1
condition: qbs.targetOS.contains('tvos') &&
diff --git a/share/qbs/modules/cpp/watchos-gcc.qbs b/share/qbs/modules/cpp/watchos-gcc.qbs
index c8bd0a55d..46e4bf874 100644
--- a/share/qbs/modules/cpp/watchos-gcc.qbs
+++ b/share/qbs/modules/cpp/watchos-gcc.qbs
@@ -29,8 +29,6 @@
**
****************************************************************************/
-import qbs
-
DarwinGCC {
priority: 1
condition: qbs.targetOS.contains('watchos') &&
diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs
index 3e3ba409d..27382742f 100644
--- a/share/qbs/modules/cpp/windows-mingw.qbs
+++ b/share/qbs/modules/cpp/windows-mingw.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.ModUtils
import qbs.TextFile
import qbs.Utilities
diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs
index 3164e08b5..8dd6dd2c0 100644
--- a/share/qbs/modules/cpp/windows-msvc.qbs
+++ b/share/qbs/modules/cpp/windows-msvc.qbs
@@ -28,7 +28,6 @@
**
****************************************************************************/
-import qbs 1.0
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
@@ -114,7 +113,6 @@ CppModule {
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
debugInfoSuffix: ".pdb"
- property string dynamicLibraryImportSuffix: ".lib"
imageFormat: "pe"
Properties {
condition: product.multiplexByQbsProperties.contains("buildVariants")
@@ -170,14 +168,20 @@ CppModule {
}
Rule {
- id: compiler
+ name: "compiler"
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
explicitlyDependsOn: ["c_pch", "cpp_pch"]
- Artifact {
- fileTags: ['obj']
- filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".obj"
+ outputFileTags: ["obj", "intermediate_obj"]
+ outputArtifacts: {
+ var tags = input.fileTags.contains("cpp_intermediate_object")
+ ? ["intermediate_obj"]
+ : ["obj"];
+ return [{
+ fileTags: tags,
+ filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".obj"
+ }];
}
prepare: {
@@ -191,7 +195,7 @@ CppModule {
}
Rule {
- id: applicationLinker
+ name: "applicationLinker"
multiplex: true
inputs: ['obj', 'native.pe.manifest']
inputsFromDependencies: ['staticlibrary', 'dynamiclibrary_import', "debuginfo_app"]
@@ -221,7 +225,7 @@ CppModule {
}
Rule {
- id: dynamicLibraryLinker
+ name: "dynamicLibraryLinker"
multiplex: true
inputs: ['obj', 'native.pe.manifest']
inputsFromDependencies: ['staticlibrary', 'dynamiclibrary_import', "debuginfo_dll"]
@@ -256,7 +260,7 @@ CppModule {
}
Rule {
- id: libtool
+ name: "libtool"
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
@@ -289,6 +293,7 @@ CppModule {
var cmd = new Command("lib.exe", args);
cmd.description = 'creating ' + lib.fileName;
cmd.highlight = 'linker';
+ cmd.jobPool = "linker";
cmd.workingDirectory = FileInfo.path(lib.filePath)
cmd.responseFileUsagePrefix = '@';
return cmd;
@@ -341,6 +346,7 @@ CppModule {
var cmd = new Command('rc', args);
cmd.description = 'compiling ' + input.fileName;
cmd.highlight = 'compiler';
+ cmd.jobPool = "compiler";
if (!hasNoLogo) {
// Remove the first two lines of stdout. That's the logo.
@@ -377,6 +383,7 @@ CppModule {
ModUtils.moduleProperty(input, 'flags', 'asm'));
var cmd = new Command(product.cpp.assemblerPath, args);
cmd.description = "assembling " + input.fileName;
+ cmd.jobPool = "assembler";
cmd.inputFileName = input.fileName;
cmd.stdoutFilterFunction = function(output) {
var lines = output.split("\r\n").filter(function (s) {