From eed1db08c739fd22eb00e55206eb7b28310d79d0 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 24 Sep 2019 12:02:51 +0300 Subject: Refactor the map file generation property 1. It is makes sense to define this property once inside of CppModule, instead of duplicate it in each other module. 2. A new property name 'generateLinkerMapFile' will be better than a previous, so, we can rename this property. 3. The map file generation is not necessary to be always enabled, so, we can disable this property by default. Change-Id: I0439e8b3e0273593c8456d32b1c099ff09498fad Reviewed-by: Christian Kandeler --- doc/reference/modules/cpp-module.qdoc | 4 ++-- share/qbs/modules/cpp/CppModule.qbs | 6 ++++++ share/qbs/modules/cpp/iar.js | 4 ++-- share/qbs/modules/cpp/iar.qbs | 10 ++-------- share/qbs/modules/cpp/keil.js | 4 ++-- share/qbs/modules/cpp/keil.qbs | 10 ++-------- share/qbs/modules/cpp/sdcc.js | 2 +- share/qbs/modules/cpp/sdcc.qbs | 10 ++-------- .../generator/iarew/archs/arm/armlinkersettingsgroup_v8.cpp | 2 +- .../generator/iarew/archs/avr/avrlinkersettingsgroup_v7.cpp | 2 +- .../iarew/archs/mcs51/mcs51linkersettingsgroup_v10.cpp | 2 +- .../iarew/archs/msp430/msp430linkersettingsgroup_v7.cpp | 2 +- .../generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.cpp | 2 +- .../generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp | 2 +- 14 files changed, 25 insertions(+), 37 deletions(-) diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index 9f554dc1c..e70f2bf5a 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -1670,12 +1670,12 @@ */ /*! - \qmlproperty bool cpp::generateMapFile + \qmlproperty bool cpp::generateLinkerMapFile \since Qbs 1.13 \baremetalproperty Whether to auto-generate a linker map file. - \defaultvalue \c{true} + \defaultvalue \c{false} */ diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index 200d91d09..50ce59b95 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -251,6 +251,12 @@ Module { description: "additional compiler driver flags used for linking only" } + property bool generateLinkerMapFile: false + PropertyOptions { + name: "generateLinkerMapFile" + description: "generate linker map file" + } + property bool positionIndependentCode: true PropertyOptions { name: "positionIndependentCode" diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 436bdb8ee..b787901b2 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -551,7 +551,7 @@ function linkerFlags(project, product, input, outputs) { // Silent output generation flag. args.push("--silent"); // Map file generation flag. - if (product.cpp.generateMapFile) + if (product.cpp.generateLinkerMapFile) args.push("--map", outputs.map_file[0].filePath); // Entry point flag. if (product.cpp.entryPoint) @@ -568,7 +568,7 @@ function linkerFlags(project, product, input, outputs) { if (product.cpp.debugInformation) args.push("-rt"); // Map file generation flag. - if (product.cpp.generateMapFile) + if (product.cpp.generateLinkerMapFile) args.push("-l", outputs.map_file[0].filePath); // Entry point flag. if (product.cpp.entryPoint) diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs index 8140a8e73..fef84fe1b 100644 --- a/share/qbs/modules/cpp/iar.qbs +++ b/share/qbs/modules/cpp/iar.qbs @@ -68,12 +68,6 @@ CppModule { property string compilerExtension: qbs.hostOS.contains("windows") ? ".exe" : "" - property bool generateMapFile: true - PropertyOptions { - name: "generateMapFile" - description: "produce a linker list file (enabled by default)" - } - /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName @@ -142,7 +136,7 @@ CppModule { outputFileTags: { var tags = ["application"]; - if (product.moduleProperty("cpp", "generateMapFile")) + if (product.moduleProperty("cpp", "generateLinkerMapFile")) tags.push("map_file"); return tags; } @@ -154,7 +148,7 @@ CppModule { PathTools.applicationFilePath(product)) }; var artifacts = [app]; - if (product.cpp.generateMapFile) { + if (product.cpp.generateLinkerMapFile) { artifacts.push({ fileTags: ["map_file"], filePath: FileInfo.joinPaths( diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js index 4b3665715..fc485373b 100644 --- a/share/qbs/modules/cpp/keil.js +++ b/share/qbs/modules/cpp/keil.js @@ -604,7 +604,7 @@ function linkerFlags(project, product, input, outputs) { args.push("TO", '"' + FileInfo.toWindowsSeparators(outputs.application[0].filePath) + '"'); // Map file generation flag. - if (!product.cpp.generateMapFile) + if (!product.cpp.generateLinkerMapFile) args.push("NOMAP"); } else if (architecture === "arm") { // Inputs. @@ -629,7 +629,7 @@ function linkerFlags(project, product, input, outputs) { args.push(debugInformation ? "--debug" : "--no_debug"); // Map file generation flag. - if (product.cpp.generateMapFile) + if (product.cpp.generateLinkerMapFile) args.push("--list", outputs.map_file[0].filePath); // Entry point flag. diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index 2d29112cd..75eb323e3 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -68,12 +68,6 @@ CppModule { property string compilerExtension: qbs.hostOS.contains("windows") ? ".exe" : "" - property bool generateMapFile: true - PropertyOptions { - name: "generateMapFile" - description: "produce a linker list file (enabled by default)" - } - /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName @@ -141,7 +135,7 @@ CppModule { outputFileTags: { var tags = ["application"]; - if (product.moduleProperty("cpp", "generateMapFile")) + if (product.moduleProperty("cpp", "generateLinkerMapFile")) tags.push("map_file"); return tags; } @@ -153,7 +147,7 @@ CppModule { PathTools.applicationFilePath(product)) }; var artifacts = [app]; - if (product.cpp.generateMapFile) { + if (product.cpp.generateLinkerMapFile) { artifacts.push({ fileTags: ["map_file"], filePath: FileInfo.joinPaths( diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index 70efa83e8..cc76d4ebd 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -355,7 +355,7 @@ function linkerFlags(project, product, input, outputs) { var escapableLinkerFlags = []; // Map file generation flag. - if (product.cpp.generateMapFile) + if (product.cpp.generateLinkerMapFile) escapableLinkerFlags.push("-m"); if (product.cpp.platformLinkerFlags) diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs index 119a0ba92..6bcbc2580 100644 --- a/share/qbs/modules/cpp/sdcc.qbs +++ b/share/qbs/modules/cpp/sdcc.qbs @@ -68,12 +68,6 @@ CppModule { property string compilerExtension: qbs.hostOS.contains("windows") ? ".exe" : "" - property bool generateMapFile: true - PropertyOptions { - name: "generateMapFile" - description: "produce a linker list file (enabled by default)" - } - /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName @@ -151,7 +145,7 @@ CppModule { outputFileTags: { var tags = ["application"]; - if (product.moduleProperty("cpp", "generateMapFile")) + if (product.moduleProperty("cpp", "generateLinkerMapFile")) tags.push("map_file"); return tags; } @@ -163,7 +157,7 @@ CppModule { PathTools.applicationFilePath(product)) }; var artifacts = [app]; - if (product.cpp.generateMapFile) { + if (product.cpp.generateLinkerMapFile) { artifacts.push({ fileTags: ["map_file"], filePath: FileInfo.joinPaths( diff --git a/src/plugins/generator/iarew/archs/arm/armlinkersettingsgroup_v8.cpp b/src/plugins/generator/iarew/archs/arm/armlinkersettingsgroup_v8.cpp index b6b755b70..7e29c2788 100644 --- a/src/plugins/generator/iarew/archs/arm/armlinkersettingsgroup_v8.cpp +++ b/src/plugins/generator/iarew/archs/arm/armlinkersettingsgroup_v8.cpp @@ -225,7 +225,7 @@ struct ListPageOptions final { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( - qbsProps, QStringLiteral("generateMapFile")) + qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } diff --git a/src/plugins/generator/iarew/archs/avr/avrlinkersettingsgroup_v7.cpp b/src/plugins/generator/iarew/archs/avr/avrlinkersettingsgroup_v7.cpp index 9fdb57a5a..59ba515d9 100644 --- a/src/plugins/generator/iarew/archs/avr/avrlinkersettingsgroup_v7.cpp +++ b/src/plugins/generator/iarew/archs/avr/avrlinkersettingsgroup_v7.cpp @@ -183,7 +183,7 @@ struct ListPageOptions final { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( - qbsProps, QStringLiteral("generateMapFile")) + qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } diff --git a/src/plugins/generator/iarew/archs/mcs51/mcs51linkersettingsgroup_v10.cpp b/src/plugins/generator/iarew/archs/mcs51/mcs51linkersettingsgroup_v10.cpp index 32b734d4a..a88ac22e1 100644 --- a/src/plugins/generator/iarew/archs/mcs51/mcs51linkersettingsgroup_v10.cpp +++ b/src/plugins/generator/iarew/archs/mcs51/mcs51linkersettingsgroup_v10.cpp @@ -148,7 +148,7 @@ struct ListPageOptions final { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( - qbsProps, QStringLiteral("generateMapFile")) + qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } diff --git a/src/plugins/generator/iarew/archs/msp430/msp430linkersettingsgroup_v7.cpp b/src/plugins/generator/iarew/archs/msp430/msp430linkersettingsgroup_v7.cpp index c7459dc49..b85edbb83 100644 --- a/src/plugins/generator/iarew/archs/msp430/msp430linkersettingsgroup_v7.cpp +++ b/src/plugins/generator/iarew/archs/msp430/msp430linkersettingsgroup_v7.cpp @@ -135,7 +135,7 @@ struct ListPageOptions final { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( - qbsProps, QStringLiteral("generateMapFile")) + qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } diff --git a/src/plugins/generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.cpp b/src/plugins/generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.cpp index 731c8d91e..2d3780e4f 100644 --- a/src/plugins/generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.cpp +++ b/src/plugins/generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.cpp @@ -208,7 +208,7 @@ struct ListPageOptions final { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( - qbsProps, QStringLiteral("generateMapFile")) + qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp index 511a16ab8..18da47c84 100644 --- a/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp +++ b/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp @@ -50,7 +50,7 @@ struct MiscPageOptions final const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); generateLinkerMap = gen::utils::cppBooleanModuleProperty( - qbsProps, QStringLiteral("generateMapFile")); + qbsProps, QStringLiteral("generateLinkerMapFile")); } int generateLinkerMap = 0; -- cgit v1.2.3