aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-07-08 15:26:15 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-07-14 18:17:58 +0200
commite4a7972ae9eaa88633adefefef38804653515c01 (patch)
tree889ae128a32e3b1aea7fe1874175ea830e6192ab /share
parentecc03e2e54a94562df750e571fc1058d012e0f57 (diff)
work around bug in icecc client
When passing the -x argument to gcc, current icecc versions (at least until 1.0.1) refuse to distribute the job to a remote machine. We work around this issue by skipping the -x argument if the file tag matches the language determined by the file extension. Task-number: QBS-625 Change-Id: Id12a158b8adf202ddc771f411e9539e26a5598be Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/cpp/gcc.js46
1 files changed, 35 insertions, 11 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index b01a4bb0e..f10ae9bd0 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -244,6 +244,27 @@ function languageName(fileTag) {
}
function prepareCompiler(project, product, inputs, outputs, input, output) {
+
+ function languageTagFromFileExtension(fileName) {
+ var i = fileName.lastIndexOf('.');
+ if (i === -1)
+ return;
+ var m = {
+ "c" : "c",
+ "C" : "cpp",
+ "cpp" : "cpp",
+ "cxx" : "cpp",
+ "c++" : "cpp",
+ "cc" : "cpp",
+ "m" : "objc",
+ "mm" : "objcpp",
+ "s" : "asm",
+ "S" : "asm_cpp",
+ "sx" : "asm_cpp"
+ };
+ return m[fileName.substring(i + 1)];
+ }
+
var i, c;
// Determine which C-language we're compiling
@@ -276,8 +297,20 @@ function prepareCompiler(project, product, inputs, outputs, input, output) {
args = args.concat(ModUtils.moduleProperties(input, 'platformCommonCompilerFlags'));
- args.push('-x');
- args.push(Gcc.languageName(tag) + (pchOutput ? '-header' : ''));
+ var compilerPath;
+ var compilerPathByLanguage = ModUtils.moduleProperty(product, "compilerPathByLanguage");
+ if (compilerPathByLanguage)
+ compilerPath = compilerPathByLanguage[tag];
+ if (!compilerPath || tag !== languageTagFromFileExtension(input.fileName)) {
+ // Only push '-x language' if we have to.
+ args.push('-x');
+ args.push(languageName(tag) + (pchOutput ? '-header' : ''));
+ }
+ if (!compilerPath) {
+ // fall back to main compiler
+ compilerPath = ModUtils.moduleProperty(product, "compilerPath");
+ }
+
args = args.concat(ModUtils.moduleProperties(input, 'platformFlags', tag),
ModUtils.moduleProperties(input, 'flags', tag));
@@ -292,15 +325,6 @@ function prepareCompiler(project, product, inputs, outputs, input, output) {
args = args.concat(additionalCompilerFlags(product, input, output));
args = args.concat(additionalCompilerAndLinkerFlags(product));
- var compilerPath;
- var compilerPathByLanguage = ModUtils.moduleProperty(product, "compilerPathByLanguage");
- if (compilerPathByLanguage)
- compilerPath = compilerPathByLanguage[tag];
- if (!compilerPath) {
- // fall back to main compiler
- compilerPath = ModUtils.moduleProperty(product, "compilerPath");
- }
-
var wrapperArgs = ModUtils.moduleProperty(product, "compilerWrapper");
if (wrapperArgs && wrapperArgs.length > 0) {
args.unshift(compilerPath);