diff options
Diffstat (limited to 'share/qbs/modules/cpp/keil.js')
-rw-r--r-- | share/qbs/modules/cpp/keil.js | 60 |
1 files changed, 46 insertions, 14 deletions
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; |