aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-08-02 10:44:26 -0700
committerJake Petroules <jake.petroules@qt.io>2016-08-15 17:00:52 +0000
commit0e123c1896b2601af4d2c097258a30706ca35f09 (patch)
treea952b39ebe03b3f95122e3abeeca27dd1c367c3b
parent62cb950144d5eccdbc210ecda2f2a9fc4f5f72a6 (diff)
Introduce cpp.driverFlags
This property allows specifying a set of flags to pass to the compiler driver. Effectively this is similar to specifying flags in both *compilerFlags and linkerFlags, except driverFlags will never be passed to the system linker. [ChangeLog] Introduced cpp.driverFlags, which allows specifying flags to be passed to the compiler driver (in any mode), but never the system linker. Change-Id: I2171246f3b20cbaca74114cf4fa0b6d38c23c621 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--doc/reference/modules/cpp-module.qdoc7
-rw-r--r--share/qbs/modules/Android/ndk/utils.js4
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs7
-rw-r--r--share/qbs/modules/cpp/android-gcc.qbs2
-rw-r--r--share/qbs/modules/cpp/gcc.js12
5 files changed, 28 insertions, 4 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc
index 330fc3455..fb7c15f47 100644
--- a/doc/reference/modules/cpp-module.qdoc
+++ b/doc/reference/modules/cpp-module.qdoc
@@ -169,6 +169,13 @@
\li \c{"all"}
\li Specifies the warning level for the compiler - \c{"none"} or \c{"all"}.
\row
+ \li driverFlags
+ \li \c{stringList}
+ \li 1.6
+ \li undefined
+ \li Flags that are added to all compilation and linking commands performed by the compiler
+ driver, independently of the language.
+ \row
\li commonCompilerFlags
\li \c{stringList}
\li 1.0.1
diff --git a/share/qbs/modules/Android/ndk/utils.js b/share/qbs/modules/Android/ndk/utils.js
index bcb60ae03..f5a4552d9 100644
--- a/share/qbs/modules/Android/ndk/utils.js
+++ b/share/qbs/modules/Android/ndk/utils.js
@@ -62,7 +62,7 @@ function androidAbi(arch) {
}
function commonCompilerFlags(buildVariant, abi, armMode) {
- var flags = ["-ffunction-sections", "-funwind-tables", "-no-canonical-prefixes",
+ var flags = ["-ffunction-sections", "-funwind-tables",
"-Wa,--noexecstack", "-Werror=format-security"];
if (buildVariant === "debug")
@@ -112,7 +112,7 @@ function commonCompilerFlags(buildVariant, abi, armMode) {
}
function commonLinkerFlags(abi) {
- var flags = ["-no-canonical-prefixes", "-Wl,-z,noexecstack", "-Wl,-z,relro", "-Wl,-z,now"];
+ var flags = ["-Wl,-z,noexecstack", "-Wl,-z,relro", "-Wl,-z,now"];
if (abi === "armeabi-v7a") {
flags.push("-Wl,--fix-cortex-a8");
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index dd3b62935..6aa0211a3 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -212,6 +212,12 @@ Module {
description: "additional linker flags"
}
+ property stringList driverFlags
+ PropertyOptions {
+ name: "driverFlags"
+ description: "additional compiler driver flags"
+ }
+
property bool positionIndependentCode
PropertyOptions {
name: "positionIndependentCode"
@@ -282,6 +288,7 @@ Module {
property stringList platformObjcFlags
property stringList platformObjcxxFlags
property stringList platformLinkerFlags
+ property stringList platformDriverFlags
// Apple platforms properties
property bool automaticReferenceCounting
diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs
index ad8437a21..34ef322b6 100644
--- a/share/qbs/modules/cpp/android-gcc.qbs
+++ b/share/qbs/modules/cpp/android-gcc.qbs
@@ -113,6 +113,8 @@ LinuxGCC {
linkerFlags: NdkUtils.commonLinkerFlags(Android.ndk.abi)
+ platformDriverFlags: ["-no-canonical-prefixes"]
+
libraryPaths: {
var prefix = FileInfo.joinPaths(sysroot, "usr");
var paths = [];
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index c3a8b819a..3fb0d59e8 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -240,7 +240,7 @@ function linkerFlags(product, inputs, output) {
if (isDarwin && ModUtils.moduleProperty(product, "warningLevel") === "none")
args.push('-w');
- args = args.concat(configFlags(product));
+ args = args.concat(configFlags(product, useCompilerDriverLinker(product, inputs)));
args = args.concat(ModUtils.moduleProperties(product, 'platformLinkerFlags'));
args = args.concat(ModUtils.moduleProperties(product, 'linkerFlags'));
@@ -298,9 +298,17 @@ function linkerFlags(product, inputs, output) {
}
// for compiler AND linker
-function configFlags(config) {
+function configFlags(config, isDriver) {
+ if (isDriver === undefined)
+ isDriver = true;
+
var args = [];
+ if (isDriver) {
+ args = args.concat(ModUtils.moduleProperties(config, 'platformDriverFlags'));
+ args = args.concat(ModUtils.moduleProperties(config, 'driverFlags'));
+ }
+
var frameworkPaths = ModUtils.moduleProperties(config, 'frameworkPaths');
if (frameworkPaths)
args = args.concat(frameworkPaths.map(function(path) { return '-F' + path }));