diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-03-18 11:39:12 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-03-18 16:53:21 +0100 |
commit | d3a7df685b080f877caa582b79253ef322868e54 (patch) | |
tree | b5062b2402cf3be7173d1cd3242631b4ae3d6b3a /share | |
parent | 1db486e0e137056fae9361bbfea47e233572a9d8 (diff) |
introduce properties for platform-specific compiler flags
The platform*Flags properties are intended to be set by the toolchain
setup and are prepended to the corresponding user properties.
Change-Id: I417c8210bfe2a091f3df5077002300d9c9e9ac7f
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 8 | ||||
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 20 | ||||
-rw-r--r-- | share/qbs/modules/cpp/windows-msvc.qbs | 18 |
3 files changed, 36 insertions, 10 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index a1e3c2812..33cefca67 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -87,6 +87,14 @@ Module { allowedValues: ['default', 'hidden', 'hiddenInlines'] } + // Platform properties. Those are intended to be set by the toolchain setup + // and are prepended to the corresponding user properties. + property var platformCFlags + property var platformCxxFlags + property var platformObjcFlags + property var platformObjcxxFlags + property var platformLinkerFlags + FileTagger { pattern: "*.c" fileTags: ["c"] diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 11de5c24a..fdc236ed4 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -60,6 +60,7 @@ CppModule { 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 platformLinkerFlags = ModUtils.moduleProperties(product, 'platformLinkerFlags'); var linkerFlags = ModUtils.moduleProperties(product, 'linkerFlags'); var i; var args = Gcc.configFlags(product); @@ -72,6 +73,7 @@ CppModule { '-Wl,--no-undefined', '-Wl,-soname=' + FileInfo.fileName(output.fileName) ]); + args = args.concat(platformLinkerFlags); for (i in linkerFlags) args.push(linkerFlags[i]) for (i in inputs.obj) @@ -173,6 +175,7 @@ CppModule { 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 platformLinkerFlags = ModUtils.moduleProperties(product, 'platformLinkerFlags'); var linkerFlags = ModUtils.moduleProperties(product, 'linkerFlags'); var args = Gcc.configFlags(product); for (var i in inputs.obj) @@ -180,6 +183,7 @@ CppModule { var sysroot = ModUtils.moduleProperty(product, "sysroot") if (sysroot) args.push('--sysroot=' + sysroot) + args = args.concat(platformLinkerFlags); for (i in linkerFlags) args.push(linkerFlags[i]) if (product.consoleApplication !== undefined @@ -294,22 +298,30 @@ CppModule { } for (i = 0, c = input.fileTags.length; i < c; ++i) { if (input.fileTags[i] === "cpp") { - args = args.concat(cxxFlags); + args = args.concat( + ModUtils.moduleProperties(input, 'platformCxxFlags'), + cxxFlags); break; } else if (input.fileTags[i] === "c") { args.push('-x'); args.push('c'); - args = args.concat(cFlags); + args = args.concat( + ModUtils.moduleProperties(input, 'platformCFlags'), + cFlags); break; } else if (input.fileTags[i] === "objc") { args.push('-x'); args.push('objective-c'); - args = args.concat(objcFlags); + args = args.concat( + ModUtils.moduleProperties(input, 'platformObjcFlags'), + objcFlags); break; } else if (input.fileTags[i] === "objcpp") { args.push('-x'); args.push('objective-c++'); - args = args.concat(objcxxFlags); + args = args.concat( + ModUtils.moduleProperties(input, 'platformObjcxxFlags'), + objcxxFlags); break; } } diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs index 5039fc91f..f0cf44270 100644 --- a/share/qbs/modules/cpp/windows-msvc.qbs +++ b/share/qbs/modules/cpp/windows-msvc.qbs @@ -83,8 +83,10 @@ CppModule { var defines = ModUtils.moduleProperties(input, 'defines'); var includePaths = ModUtils.moduleProperties(input, 'includePaths'); var systemIncludePaths = ModUtils.moduleProperties(input, 'systemIncludePaths'); - var cFlags = ModUtils.moduleProperties(input, 'cFlags'); - var cxxFlags = ModUtils.moduleProperties(input, 'cxxFlags'); + var cFlags = ModUtils.moduleProperties(input, 'platformCFlags').concat( + ModUtils.moduleProperties(input, 'cFlags')); + var cxxFlags = ModUtils.moduleProperties(input, 'platformCxxFlags').concat( + ModUtils.moduleProperties(input, 'cxxFlags')); return MSVC.prepareCompiler(product, input, outputs, platformDefines, defines, includePaths, systemIncludePaths, cFlags, cxxFlags) } } @@ -104,8 +106,10 @@ CppModule { var defines = ModUtils.moduleProperties(input, 'defines'); var includePaths = ModUtils.moduleProperties(input, 'includePaths'); var systemIncludePaths = ModUtils.moduleProperties(input, 'systemIncludePaths'); - var cFlags = ModUtils.moduleProperties(input, 'cFlags'); - var cxxFlags = ModUtils.moduleProperties(input, 'cxxFlags'); + var cFlags = ModUtils.moduleProperties(input, 'platformCFlags').concat( + ModUtils.moduleProperties(input, 'cFlags')); + var cxxFlags = ModUtils.moduleProperties(input, 'platformCxxFlags').concat( + ModUtils.moduleProperties(input, 'cxxFlags')); return MSVC.prepareCompiler(product, input, outputs, platformDefines, defines, includePaths, systemIncludePaths, cFlags, cxxFlags) } } @@ -125,7 +129,8 @@ CppModule { var libraryPaths = ModUtils.moduleProperties(product, 'libraryPaths'); var dynamicLibraries = ModUtils.modulePropertiesFromArtifacts(product, inputs.dynamiclibrary_import, 'cpp', 'dynamicLibraries'); var staticLibraries = ModUtils.modulePropertiesFromArtifacts(product, (inputs.staticlibrary || []).concat(inputs.obj), 'cpp', 'staticLibraries'); - var linkerFlags = ModUtils.moduleProperties(product, 'linkerFlags'); + var linkerFlags = ModUtils.moduleProperties(product, 'platformLinkerFlags').concat( + ModUtils.moduleProperties(product, 'linkerFlags')); return MSVC.prepareLinker(product, inputs, outputs, libraryPaths, dynamicLibraries, staticLibraries, linkerFlags) } } @@ -155,7 +160,8 @@ CppModule { var libraryPaths = ModUtils.moduleProperties(product, 'libraryPaths'); var dynamicLibraries = ModUtils.moduleProperties(product, 'dynamicLibraries'); var staticLibraries = ModUtils.modulePropertiesFromArtifacts(product, (inputs.staticlibrary || []).concat(inputs.obj), 'cpp', 'staticLibraries'); - var linkerFlags = ModUtils.moduleProperties(product, 'linkerFlags'); + var linkerFlags = ModUtils.moduleProperties(product, 'platformLinkerFlags').concat( + ModUtils.moduleProperties(product, 'linkerFlags')); return MSVC.prepareLinker(product, inputs, outputs, libraryPaths, dynamicLibraries, staticLibraries, linkerFlags) } } |