aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs12
-rw-r--r--share/qbs/modules/cpp/iar.js40
-rw-r--r--share/qbs/modules/cpp/iar.qbs10
-rw-r--r--share/qbs/modules/cpp/keil.js60
-rw-r--r--share/qbs/modules/cpp/keil.qbs10
-rw-r--r--share/qbs/modules/cpp/sdcc.js10
-rw-r--r--share/qbs/modules/cpp/sdcc.qbs4
7 files changed, 107 insertions, 39 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index 50ce59b95..efda896da 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -257,6 +257,18 @@ Module {
description: "generate linker map file"
}
+ property bool generateCompilerListingFiles: false
+ PropertyOptions {
+ name: "generateCompilerListingFiles"
+ description: "generate compiler listing files"
+ }
+
+ property bool generateAssemblerListingFiles: false
+ PropertyOptions {
+ name: "generateAssemblerListingFiles"
+ description: "generate assembler listing files"
+ }
+
property bool positionIndependentCode: true
PropertyOptions {
name: "positionIndependentCode"
diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js
index bff0739b1..fd6f993e4 100644
--- a/share/qbs/modules/cpp/iar.js
+++ b/share/qbs/modules/cpp/iar.js
@@ -339,13 +339,21 @@ function collectLibraryDependencies(product) {
return result;
}
-function compilerOutputArtifacts(input) {
- var obj = {
+function compilerOutputArtifacts(input, useListing) {
+ var artifacts = [];
+ artifacts.push({
fileTags: ["obj"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + input.cpp.objectSuffix
- };
- return [obj];
+ });
+ if (useListing) {
+ artifacts.push({
+ fileTags: ["lst"],
+ filePath: Utilities.getHash(input.baseDir) + "/"
+ + input.fileName + ".lst"
+ });
+ }
+ return artifacts;
}
function applicationLinkerOutputArtifacts(product) {
@@ -374,9 +382,9 @@ function staticLibraryLinkerOutputArtifacts(product) {
return [staticLib]
}
-function compilerFlags(project, product, input, output, explicitlyDependsOn) {
+function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
// Determine which C-language we're compiling.
- var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
+ var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
var args = [];
@@ -384,7 +392,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
args.push(input.filePath);
// Output.
- args.push("-o", output.filePath);
+ args.push("-o", outputs.obj[0].filePath);
// Defines.
var allDefines = [];
@@ -490,6 +498,10 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
break;
}
+ // Listing files generation flag.
+ if (product.cpp.generateCompilerListingFiles)
+ args.push("-l", outputs.lst[0].filePath);
+
// Misc flags.
args = args.concat(ModUtils.moduleProperty(input, "platformFlags"),
ModUtils.moduleProperty(input, "flags"),
@@ -499,9 +511,9 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
return args;
}
-function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
+function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
// Determine which C-language we"re compiling
- var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
+ var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
var args = [];
@@ -509,7 +521,7 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
args.push(input.filePath);
// Output.
- args.push("-o", output.filePath);
+ args.push("-o", outputs.obj[0].filePath);
// Includes.
var allIncludePaths = [];
@@ -543,6 +555,10 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
break;
}
+ // Listing files generation flag.
+ if (product.cpp.generateAssemblerListingFiles)
+ args.push("-l", outputs.lst[0].filePath);
+
// Misc flags.
args = args.concat(ModUtils.moduleProperty(input, "platformFlags", tag),
ModUtils.moduleProperty(input, "flags", tag),
@@ -633,7 +649,7 @@ function archiverFlags(project, product, input, outputs) {
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
- var args = compilerFlags(project, product, input, output, explicitlyDependsOn);
+ var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var compilerPath = input.cpp.compilerPath;
var cmd = new Command(compilerPath, args);
cmd.description = "compiling " + input.fileName;
@@ -642,7 +658,7 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
- var args = assemblerFlags(project, product, input, output, explicitlyDependsOn);
+ var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var assemblerPath = input.cpp.assemblerPath;
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs
index e006856bf..bc226389b 100644
--- a/share/qbs/modules/cpp/iar.qbs
+++ b/share/qbs/modules/cpp/iar.qbs
@@ -99,8 +99,9 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
- outputFileTags: ["obj"]
- outputArtifacts: IAR.compilerOutputArtifacts(input)
+ outputFileTags: ["obj", "lst"]
+ outputArtifacts: IAR.compilerOutputArtifacts(
+ input, input.cpp.generateAssemblerListingFiles)
prepare: IAR.prepareAssembler.apply(IAR, arguments)
}
@@ -113,8 +114,9 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
- outputFileTags: ["obj"]
- outputArtifacts: IAR.compilerOutputArtifacts(input)
+ outputFileTags: ["obj", "lst"]
+ outputArtifacts: IAR.compilerOutputArtifacts(
+ input, input.cpp.generateCompilerListingFiles)
prepare: IAR.prepareCompiler.apply(IAR, arguments)
}
diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js
index dd73b375e..befcc5a33 100644
--- a/share/qbs/modules/cpp/keil.js
+++ b/share/qbs/modules/cpp/keil.js
@@ -328,13 +328,23 @@ function filterStdOutput(cmd) {
};
}
-function compilerOutputArtifacts(input) {
- var obj = {
+function compilerOutputArtifacts(input, useListing) {
+ var artifacts = [];
+ artifacts.push({
fileTags: ["obj"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + input.cpp.objectSuffix
- };
- return [obj];
+ });
+ if (useListing) {
+ artifacts.push({
+ fileTags: ["lst"],
+ filePath: Utilities.getHash(input.baseDir) + "/"
+ + (input.cpp.architecture === "mcs51"
+ ? input.fileName : input.baseName)
+ + ".lst"
+ });
+ }
+ return artifacts;
}
function applicationLinkerOutputArtifacts(product) {
@@ -364,9 +374,9 @@ function staticLibraryLinkerOutputArtifacts(product) {
return [staticLib]
}
-function compilerFlags(project, product, input, output, explicitlyDependsOn) {
+function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
// Determine which C-language we're compiling.
- var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
+ var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
var args = [];
var allDefines = [];
@@ -394,7 +404,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
args.push(FileInfo.toWindowsSeparators(input.filePath));
// Output.
- args.push("OBJECT (" + FileInfo.toWindowsSeparators(output.filePath) + ")");
+ args.push("OBJECT (" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")");
// Defines.
if (allDefines.length > 0)
@@ -433,12 +443,18 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
args.push("FARWARNING");
break;
}
+
+ // Listing files generation flag.
+ if (!product.cpp.generateCompilerListingFiles)
+ args.push("NOPRINT");
+ else
+ args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")");
} else if (architecture === "arm") {
// Input.
args.push("-c", input.filePath);
// Output.
- args.push("-o", output.filePath);
+ args.push("-o", outputs.obj[0].filePath);
// Defines.
args = args.concat(allDefines.map(function(define) { return '-D' + define }));
@@ -513,6 +529,12 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
if (enableRtti !== undefined)
args.push(enableRtti ? "--rtti" : "--no_rtti");
}
+
+ // Listing files generation flag.
+ if (product.cpp.generateCompilerListingFiles) {
+ args.push("--list");
+ args.push("--list_dir", FileInfo.path(outputs.lst[0].filePath));
+ }
}
// Misc flags.
@@ -524,9 +546,9 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
return args;
}
-function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
+function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
// Determine which C-language we're compiling
- var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
+ var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
var args = [];
var allDefines = [];
@@ -554,7 +576,7 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
args.push(FileInfo.toWindowsSeparators(input.filePath));
// Output.
- args.push("OBJECT (" + FileInfo.toWindowsSeparators(output.filePath) + ")");
+ args.push("OBJECT (" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")");
// Defines.
if (allDefines.length > 0)
@@ -572,12 +594,18 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
// Enable errors printing.
args.push("EP");
+
+ // Listing files generation flag.
+ if (!product.cpp.generateAssemblerListingFiles)
+ args.push("NOPRINT");
+ else
+ args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")");
} else if (architecture === "arm") {
// Input.
args.push(input.filePath);
// Output.
- args.push("-o", output.filePath);
+ args.push("-o", outputs.obj[0].filePath);
// Defines.
allDefines.forEach(function(define) {
@@ -608,6 +636,10 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
var endianness = input.cpp.endianness;
if (endianness)
args.push((endianness === "little") ? "--littleend" : "--bigend");
+
+ // Listing files generation flag.
+ if (product.cpp.generateAssemblerListingFiles)
+ args.push("--list", outputs.lst[0].filePath);
}
// Misc flags.
@@ -737,7 +769,7 @@ function archiverFlags(project, product, input, outputs) {
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
- var args = compilerFlags(project, product, input, output, explicitlyDependsOn);
+ var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var compilerPath = input.cpp.compilerPath;
var architecture = input.cpp.architecture;
var cmd = new Command(compilerPath, args);
@@ -750,7 +782,7 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
- var args = assemblerFlags(project, product, input, output, explicitlyDependsOn);
+ var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var assemblerPath = input.cpp.assemblerPath;
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs
index aca00eb99..67ea5e675 100644
--- a/share/qbs/modules/cpp/keil.qbs
+++ b/share/qbs/modules/cpp/keil.qbs
@@ -97,8 +97,9 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
- outputFileTags: ["obj"]
- outputArtifacts: KEIL.compilerOutputArtifacts(input)
+ outputFileTags: ["obj", "lst"]
+ outputArtifacts: KEIL.compilerOutputArtifacts(
+ input, input.cpp.generateAssemblerListingFiles)
prepare: KEIL.prepareAssembler.apply(KEIL, arguments)
}
@@ -111,8 +112,9 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
- outputFileTags: ["obj"]
- outputArtifacts: KEIL.compilerOutputArtifacts(input)
+ outputFileTags: ["obj", "lst"]
+ outputArtifacts: KEIL.compilerOutputArtifacts(
+ input, input.cpp.generateCompilerListingFiles)
prepare: KEIL.prepareCompiler.apply(KEIL, arguments)
}
diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js
index 5cd5fa960..70d0506b9 100644
--- a/share/qbs/modules/cpp/sdcc.js
+++ b/share/qbs/modules/cpp/sdcc.js
@@ -224,13 +224,17 @@ function compilerOutputArtifacts(input) {
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + input.cpp.objectSuffix
};
+
+ // We need to use the asm_adb, lst, asm_src, asm_sym and rst_data
+ // artifacts without of any conditions. Because SDCC always generates
+ // it (and seems, this behavior can not be disabled for SDCC).
var asm_adb = {
fileTags: ["asm_adb"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".adb"
};
- var asm_lst = {
- fileTags: ["asm_lst"],
+ var lst = {
+ fileTags: ["lst"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".lst"
};
@@ -249,7 +253,7 @@ function compilerOutputArtifacts(input) {
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".rst"
};
- return [obj, asm_adb, asm_lst, asm_src, asm_sym, rst_data];
+ return [obj, asm_adb, lst, asm_src, asm_sym, rst_data];
}
function applicationLinkerOutputArtifacts(product) {
diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs
index bf44b6f8e..ec763ba47 100644
--- a/share/qbs/modules/cpp/sdcc.qbs
+++ b/share/qbs/modules/cpp/sdcc.qbs
@@ -99,7 +99,7 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
- outputFileTags: ["obj", "asm_adb", "asm_lst", "asm_src", "asm_sym", "rst_data"]
+ outputFileTags: ["obj", "asm_adb", "lst", "asm_src", "asm_sym", "rst_data"]
outputArtifacts: SDCC.compilerOutputArtifacts(input)
prepare: SDCC.prepareAssembler.apply(SDCC, arguments)
}
@@ -120,7 +120,7 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
- outputFileTags: ["obj", "asm_adb", "asm_lst", "asm_src", "asm_sym", "rst_data"]
+ outputFileTags: ["obj", "asm_adb", "lst", "asm_src", "asm_sym", "rst_data"]
outputArtifacts: SDCC.compilerOutputArtifacts(input)
prepare: SDCC.prepareCompiler.apply(SDCC, arguments)
}