From e0266ffc85058d371e18b0ae8ea49585697ceb59 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 31 Mar 2021 10:34:19 +0300 Subject: Share cpp::linkerMapSuffix property It makes sense to add the cpp.linkerMapSuffix property to the base CppModule due the following reasons: 1. It is possible that the user wants to change the extension for the generated map files, which makes working with Qbs more flexible. 2. It will be easier to write an autotests that check the generation of the map files for a bare metal platforms, where object files can have various extensions such as ".map", ".m51", ".m66", and so forth. Change-Id: I1e5e3b39bf84fddfe8c06f2db9d3936c6a3ff027 Reviewed-by: Ivan Komissarov Reviewed-by: Christian Kandeler --- doc/reference/modules/cpp-module.qdoc | 8 ++++++++ share/qbs/modules/cpp/CppModule.qbs | 1 + share/qbs/modules/cpp/GenericGCC.qbs | 2 +- share/qbs/modules/cpp/iar.js | 2 +- share/qbs/modules/cpp/keil.js | 4 ++-- share/qbs/modules/cpp/keil.qbs | 3 +-- share/qbs/modules/cpp/sdcc.js | 4 ++-- share/qbs/modules/cpp/windows-msvc-base.qbs | 2 +- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index e6d63eaf8..1b09320f0 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -625,6 +625,14 @@ \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c ".o" or \c ".obj" */ +/*! + \qmlproperty string cpp::linkerMapSuffix + + A string to append to the generated linker memory map files. + + \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical value is \c ".map" +*/ + /*! \qmlproperty pathList cpp::prefixHeaders \since Qbs 1.0.1 diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index 61c9c3f65..761e8be85 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -187,6 +187,7 @@ Module { property string variantSuffix: "" property string dynamicLibraryImportSuffix: ".lib" property string objectSuffix: ".o" + property string linkerMapSuffix: ".map" property bool createSymlinks: true property stringList dynamicLibraries // list of names, will be linked with -lname property stringList staticLibraries // list of static library files diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index e2d9eeab5..934636849 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -578,7 +578,7 @@ CppModule { if (product.cpp.generateLinkerMapFile) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, - product.targetName + ".map"), + product.targetName + product.cpp.linkerMapSuffix), fileTags: ["mem_map"] }); } diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 5e5f1293f..a1f1a9a88 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -640,7 +640,7 @@ function applicationLinkerOutputArtifacts(product) { fileTags: ["mem_map"], filePath: FileInfo.joinPaths( product.destinationDirectory, - product.targetName + ".map") + product.targetName + product.cpp.linkerMapSuffix) }; return [app, mem_map] } diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js index 0e8560421..567b0ddd3 100644 --- a/share/qbs/modules/cpp/keil.js +++ b/share/qbs/modules/cpp/keil.js @@ -168,7 +168,7 @@ function objectSuffix(qbs) { + architecture + "'"; } -function mapFileSuffix(qbs) { +function linkerMapSuffix(qbs) { var architecture = qbs.architecture; if (isMcs51Architecture(architecture)) return ".m51"; @@ -611,7 +611,7 @@ function applicationLinkerOutputArtifacts(product) { fileTags: ["mem_map"], filePath: FileInfo.joinPaths( product.destinationDirectory, - product.targetName + product.cpp.mapFileSuffix) + product.targetName + product.cpp.linkerMapSuffix) }; return [app, mem_map]; } diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index aa4eaadf9..f1f3b50e8 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -90,8 +90,7 @@ CppModule { staticLibrarySuffix: KEIL.staticLibrarySuffix(qbs) executableSuffix: KEIL.executableSuffix(qbs) objectSuffix: KEIL.objectSuffix(qbs) - - property string mapFileSuffix: KEIL.mapFileSuffix(qbs) + linkerMapSuffix: KEIL.linkerMapSuffix(qbs) imageFormat: KEIL.imageFormat(qbs) diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index 71ed22ffa..a47063401 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -303,7 +303,7 @@ function applicationLinkerOutputArtifacts(product) { fileTags: ["mem_map"], filePath: FileInfo.joinPaths( product.destinationDirectory, - product.targetName + ".map") + product.targetName + product.cpp.linkerMapSuffix) }; return [app, lk_cmd, mem_summary, mem_map] } @@ -651,7 +651,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) { cmd = new JavaScriptCommand(); cmd.mapFilePath = FileInfo.joinPaths( FileInfo.path(target.filePath), - FileInfo.completeBaseName(target.fileName) + ".map"); + FileInfo.completeBaseName(target.fileName) + product.cpp.linkerMapSuffix); cmd.silent = true; cmd.sourceCode = function() { File.remove(mapFilePath); }; cmds.push(cmd); diff --git a/share/qbs/modules/cpp/windows-msvc-base.qbs b/share/qbs/modules/cpp/windows-msvc-base.qbs index 97ba7c64f..b25fdf159 100644 --- a/share/qbs/modules/cpp/windows-msvc-base.qbs +++ b/share/qbs/modules/cpp/windows-msvc-base.qbs @@ -210,7 +210,7 @@ CppModule { fileTags: ["mem_map"], filePath: FileInfo.joinPaths( product.destinationDirectory, - product.targetName + ".map") + product.targetName + product.cpp.linkerMapSuffix) }); } return artifacts; -- cgit v1.2.3