summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-09-30 16:47:17 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-10-01 14:24:18 +0200
commitb04a049c13c543e786120764cd9b6f78cbd7b86a (patch)
tree8fe37e45ce4ef11114e09eee2c6f284e66d79b81 /share
parent366347c5beda3309c2988106f680ac9293f70be6 (diff)
downloadqbs-b04a049c13c543e786120764cd9b6f78cbd7b86a.tar.gz
introduce cpp.supportedStaticLibrarySuffixes
The MinGW linker supports .a and .lib files as input. Therefore we need to maintain a list of supported lib suffixes. Task-number: QBS-376 Change-Id: I2e9c3b424478a9bcf1a06df6e532517b31da0bef Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs1
-rw-r--r--share/qbs/modules/cpp/gcc.js30
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs1
3 files changed, 22 insertions, 10 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index f6ca753c1..e9bf4bcd6 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -90,6 +90,7 @@ Module {
property string executablePrefix
property string staticLibrarySuffix
property string dynamicLibrarySuffix
+ property stringList supportedStaticLibrarySuffixes: [staticLibrarySuffix]
property string executableSuffix
property stringList dynamicLibraries // list of names, will be linked with -lname
property stringList staticLibraries // list of static library files
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 701e9c6f5..ce0cf5b8d 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -8,7 +8,7 @@ function libraryLinkerFlags(product, inputs)
var frameworks = ModUtils.moduleProperties(product, 'frameworks');
var weakFrameworks = ModUtils.moduleProperties(product, 'weakFrameworks');
var rpaths = ModUtils.moduleProperties(product, 'rpaths');
- var args = [], i, prefix, suffix;
+ var args = [], i, prefix, suffix, suffixes;
if (rpaths && rpaths.length)
args.push('-Wl,-rpath,' + rpaths.join(",-rpath,"));
@@ -30,21 +30,25 @@ function libraryLinkerFlags(product, inputs)
args = args.concat(systemFrameworkPaths.map(function(path) { return '-iframework' + path }));
prefix = ModUtils.moduleProperty(product, "staticLibraryPrefix");
- suffix = ModUtils.moduleProperty(product, "staticLibrarySuffix");
+ suffixes = ModUtils.moduleProperty(product, "supportedStaticLibrarySuffixes");
for (i in staticLibraries) {
- if (isLibraryFileName(product, FileInfo.fileName(staticLibraries[i]), prefix, suffix, false))
+ if (isLibraryFileName(product, FileInfo.fileName(staticLibraries[i]), prefix, suffixes,
+ false)) {
args.push(staticLibraries[i]);
- else
+ } else {
args.push('-l' + staticLibraries[i]);
+ }
}
prefix = ModUtils.moduleProperty(product, "dynamicLibraryPrefix");
suffix = ModUtils.moduleProperty(product, "dynamicLibrarySuffix");
for (i in dynamicLibraries) {
- if (isLibraryFileName(product, FileInfo.fileName(dynamicLibraries[i]), prefix, suffix, true))
+ if (isLibraryFileName(product, FileInfo.fileName(dynamicLibraries[i]), prefix, [suffix],
+ true)) {
args.push(dynamicLibraries[i]);
- else
+ } else {
args.push('-l' + dynamicLibraries[i]);
+ }
}
suffix = ".framework";
@@ -66,12 +70,18 @@ function libraryLinkerFlags(product, inputs)
}
// Returns whether the string looks like a library filename
-function isLibraryFileName(product, fileName, prefix, suffix, isShared)
+function isLibraryFileName(product, fileName, prefix, suffixes, isShared)
{
+ var suffix, i;
var os = product.moduleProperty("qbs", "targetOS");
- if (os.contains("unix") && !os.contains("darwin") && isShared)
- suffix += "(\\.[0-9]+){0,3}";
- return fileName.match("^" + prefix + ".+?\\" + suffix + "$");
+ for (i = 0; i < suffixes.length; ++i) {
+ suffix = suffixes[i];
+ if (isShared && os.contains("unix") && !os.contains("darwin"))
+ suffix += "(\\.[0-9]+){0,3}";
+ if (fileName.match("^" + prefix + ".+?\\" + suffix + "$"))
+ return true;
+ }
+ return false;
}
// for compiler AND linker
diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs
index 1c563478e..024f887ab 100644
--- a/share/qbs/modules/cpp/windows-mingw.qbs
+++ b/share/qbs/modules/cpp/windows-mingw.qbs
@@ -9,6 +9,7 @@ GenericGCC {
dynamicLibraryPrefix: ""
executablePrefix: ""
staticLibrarySuffix: ".a"
+ supportedStaticLibrarySuffixes: [".a", ".lib"]
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
windowsApiCharacterSet: "unicode"