aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-03-01 20:05:17 -0500
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-03-04 11:19:25 +0100
commit98b7266a4d2e0100a236c7bb5e0a58d27ead2da0 (patch)
tree80c22d07d618ea11999c2f9e5d6ed5525802bbf8 /share
parent58bf2dcfd673ddc04f08122f4035e598b5adb7d9 (diff)
Provide the ability to weak-link frameworks on OS X.
Task-number: QBS-200 Change-Id: If2530b687bef6e4cbea1e5947016e4e7b72993c2 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs1
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs10
-rw-r--r--share/qbs/modules/cpp/gcc.js4
3 files changed, 12 insertions, 3 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index 84f0bf8ad..f9989063a 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -33,6 +33,7 @@ Module {
property var dynamicLibraries // list of names, will be linked with -lname
property var staticLibraries // list of static library files
property var frameworks // list of frameworks, will be linked with '-framework <name>'
+ property var weakFrameworks // list of weakly-linked frameworks, will be linked with '-weak_framework <name>'
property var rpaths
property var cppFlags
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 80ea04833..937950901 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -57,6 +57,7 @@ CppModule {
var staticLibraries = ModUtils.moduleProperties(product, 'staticLibraries');
var frameworkPaths = ModUtils.moduleProperties(product, 'frameworkPaths');
var frameworks = ModUtils.modulePropertiesFromArtifacts(product, inputs.dynamiclibrary, 'cpp', 'frameworks');
+ var weakFrameworks = ModUtils.modulePropertiesFromArtifacts(product, inputs.dynamiclibrary, 'cpp', 'weakFrameworks');
var rpaths = ModUtils.moduleProperties(product, 'rpaths');
var linkerFlags = ModUtils.moduleProperties(product, 'linkerFlags');
var i;
@@ -93,9 +94,11 @@ CppModule {
frameworksI.push(fileName);
}
+ var weakFrameworksI = weakFrameworks;
+
args.push('-o');
args.push(output.fileName);
- args = args.concat(Gcc.libs(libraryPaths, frameworkPaths, rpaths, dynamicLibraries, staticLibrariesI, frameworksI));
+ args = args.concat(Gcc.libs(libraryPaths, frameworkPaths, rpaths, dynamicLibraries, staticLibrariesI, frameworksI, weakFrameworksI));
for (i in inputs.dynamiclibrary)
args.push(inputs.dynamiclibrary[i].fileName);
var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args);
@@ -166,6 +169,7 @@ CppModule {
var staticLibraries = ModUtils.modulePropertiesFromArtifacts(product, inputs.staticlibrary, 'cpp', 'staticLibraries');
var frameworkPaths = ModUtils.moduleProperties(product, 'frameworkPaths');
var frameworks = ModUtils.modulePropertiesFromArtifacts(product, inputs.dynamiclibrary, 'cpp', 'frameworks');
+ var weakFrameworks = ModUtils.modulePropertiesFromArtifacts(product, inputs.dynamiclibrary, 'cpp', 'weakFrameworks');
var rpaths = ModUtils.moduleProperties(product, 'rpaths');
var linkerFlags = ModUtils.moduleProperties(product, 'linkerFlags');
var args = Gcc.configFlags(product);
@@ -224,7 +228,9 @@ CppModule {
frameworksI.push(fileName);
}
- args = args.concat(Gcc.libs(libraryPaths, frameworkPaths, rpaths, dynamicLibrariesI, staticLibrariesI, frameworksI));
+ var weakFrameworksI = weakFrameworks;
+
+ args = args.concat(Gcc.libs(libraryPaths, frameworkPaths, rpaths, dynamicLibrariesI, staticLibrariesI, frameworksI, weakFrameworksI));
for (i in inputs.dynamiclibrary)
args.push(inputs.dynamiclibrary[i].fileName);
var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args);
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index c9f2b9d16..f261be0d3 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -1,4 +1,4 @@
-function libs(libraryPaths, frameworkPaths, rpaths, dynamicLibraries, staticLibraries, frameworks)
+function libs(libraryPaths, frameworkPaths, rpaths, dynamicLibraries, staticLibraries, frameworks, weakFrameworks)
{
var i;
var args = [];
@@ -25,6 +25,8 @@ function libs(libraryPaths, frameworkPaths, rpaths, dynamicLibraries, staticLibr
args = args.concat(frameworkPaths.map(function(path) { return '-F' + path }));
for (i in frameworks)
args = args.concat(['-framework', frameworks[i]]);
+ for (i in weakFrameworks)
+ args = args.concat(['-weak_framework', weakFrameworks[i]]);
return args;
}