diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-09-27 12:51:01 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-10-01 09:13:42 +0000 |
commit | 7822a01904d60a883cc089175d1ca5400663040c (patch) | |
tree | 7073bd2ca811bc93ecc2e27186ee46119bfe8e34 /share/qbs/modules/cpp/sdcc.js | |
parent | 51d8271a301b5767f797e57e73ba425a64b3a359 (diff) | |
download | qbs-7822a01904d60a883cc089175d1ca5400663040c.tar.gz |
baremetal: Add missed output artifacts for SDCC compiler
Compiler produces a lot of additional ".adb", ".lst", ".asm",
".sym", ".rst", ".lk", ".mem" files. This files should be also
processed in SDCC module (e.g. it allows to remove this files
by 'clean' command).
Change-Id: Ib07dbe63ab27e263d67025ce5cd40a967910d354
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/sdcc.js')
-rw-r--r-- | share/qbs/modules/cpp/sdcc.js | 89 |
1 files changed, 81 insertions, 8 deletions
diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index c84ec0f5d..f8c0d3b12 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -33,6 +33,7 @@ var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); +var PathTools = require("qbs.PathTools"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); @@ -178,15 +179,87 @@ function collectLibraryDependencies(product) { return result; } -function compilerFlags(project, product, input, output, explicitlyDependsOn) { +function compilerOutputArtifacts(input) { + var obj = { + fileTags: ["obj"], + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + input.cpp.objectSuffix + }; + var asm_adb = { + fileTags: ["asm_adb"], + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + ".adb" + }; + var asm_lst = { + fileTags: ["asm_lst"], + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + ".lst" + }; + var asm_src = { + fileTags: ["asm_src"], + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + ".asm" + }; + var asm_sym = { + fileTags: ["asm_sym"], + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + ".sym" + }; + var rst_data = { + fileTags: ["rst_data"], + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + ".rst" + }; + return [obj, asm_adb, asm_lst, asm_src, asm_sym, rst_data]; +} + +function applicationLinkerOutputArtifacts(product) { + var app = { + fileTags: ["application"], + filePath: FileInfo.joinPaths( + product.destinationDirectory, + PathTools.applicationFilePath(product)) + }; + var lk_cmd = { + fileTags: ["lk_cmd"], + filePath: FileInfo.joinPaths( + product.destinationDirectory, + product.targetName + ".lk") + }; + var mem_summary = { + fileTags: ["mem_summary"], + filePath: FileInfo.joinPaths( + product.destinationDirectory, + product.targetName + ".mem") + }; + var mem_map = { + fileTags: ["mem_map"], + filePath: FileInfo.joinPaths( + product.destinationDirectory, + product.targetName + ".map") + }; + return [app, lk_cmd, mem_summary, mem_map] +} + +function staticLibraryLinkerOutputArtifacts(product) { + var staticLib = { + fileTags: ["staticlibrary"], + filePath: FileInfo.joinPaths( + product.destinationDirectory, + PathTools.staticLibraryFilePath(product)) + }; + return [staticLib] +} + +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 = []; args.push(input.filePath); args.push("-c"); - args.push("-o", output.filePath); + args.push("-o", outputs.obj[0].filePath); switch (input.cpp.optimization) { case "small": @@ -247,9 +320,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 = []; @@ -267,7 +340,7 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) { ModUtils.moduleProperty(input, "driverFlags", tag)); args.push("-ol"); - args.push(output.filePath); + args.push(outputs.obj[0].filePath); args.push(input.filePath); return args; } @@ -347,7 +420,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; @@ -356,7 +429,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; |