aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/cpp/gcc.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/qbs/modules/cpp/gcc.js')
-rw-r--r--share/qbs/modules/cpp/gcc.js35
1 files changed, 16 insertions, 19 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 6936beb5e..0913b27d0 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -78,7 +78,7 @@ function collectLibraryDependencies(product, isDarwin) {
var publicDeps = {};
var objects = [];
var objectByFilePath = {};
- var tagForLinkingAgainstSharedLib = product.qbs.toolchain.contains("mingw")
+ var tagForLinkingAgainstSharedLib = product.cpp.imageFormat === "pe"
? "dynamiclibrary_import" : "dynamiclibrary";
function addObject(obj, addFunc) {
@@ -278,12 +278,11 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat
}
if (isDarwin) {
- var internalVersion = product.cpp.internalVersion;
- if (internalVersion && isNumericProductVersion(internalVersion))
- args.push("-current_version", internalVersion);
+ if (product.cpp.internalVersion)
+ args.push("-current_version", product.cpp.internalVersion);
escapableLinkerFlags.push("-install_name", UnixUtils.soname(product,
primaryOutput.fileName));
- } else {
+ } else if (product.cpp.imageFormat === "elf") {
escapableLinkerFlags.push("-soname=" + UnixUtils.soname(product,
primaryOutput.fileName));
}
@@ -295,7 +294,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat
if (primaryOutput.fileTags.containsAny(["dynamiclibrary", "loadablemodule"])) {
if (isDarwin)
escapableLinkerFlags.push("-headerpad_max_install_names");
- else
+ else if (product.cpp.imageFormat === "elf")
escapableLinkerFlags.push("--as-needed");
}
@@ -344,13 +343,15 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat
return rpath;
}
- function isNotSystemRunPath(p) {
- return !FileInfo.isAbsolutePath(p) || (!systemRunPaths.contains(p)
- && !canonicalSystemRunPaths.contains(File.canonicalFilePath(p)));
- };
- for (i in rpaths) {
- if (isNotSystemRunPath(rpaths[i]))
- escapableLinkerFlags.push("-rpath", fixupRPath(rpaths[i]));
+ if (!product.qbs.targetOS.contains("windows")) {
+ function isNotSystemRunPath(p) {
+ return !FileInfo.isAbsolutePath(p) || (!systemRunPaths.contains(p)
+ && !canonicalSystemRunPaths.contains(File.canonicalFilePath(p)));
+ };
+ for (i in rpaths) {
+ if (isNotSystemRunPath(rpaths[i]))
+ escapableLinkerFlags.push("-rpath", fixupRPath(rpaths[i]));
+ }
}
if (product.cpp.entryPoint)
@@ -854,7 +855,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
}
var positionIndependentCode = input.cpp.positionIndependentCode;
- if (positionIndependentCode && !product.qbs.toolchain.contains("mingw"))
+ if (positionIndependentCode && !product.qbs.targetOS.contains("windows"))
args.push('-fPIC');
var cppFlags = input.cpp.cppFlags;
@@ -1035,7 +1036,7 @@ function linkerEnvVars(config, inputs)
function setResponseFileThreshold(command, product)
{
- if (product.qbs.toolchain.contains("mingw") && product.qbs.hostOS.contains("windows"))
+ if (product.qbs.targetOS.contains("windows") && product.qbs.hostOS.contains("windows"))
command.responseFileThreshold = 10000;
}
@@ -1432,10 +1433,6 @@ function debugInfoArtifacts(product, variants, debugInfoTagSuffix) {
return artifacts;
}
-function isNumericProductVersion(version) {
- return version && version.match(/^([0-9]+\.){0,3}[0-9]+$/);
-}
-
function dumpMacros(env, compilerFilePath, args, nullDevice, tag) {
var p = new Process();
try {