From 119ae17573193dc81969e954f2dde47172437fa9 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sun, 28 Mar 2021 18:21:15 +0300 Subject: Share cpp::objectSuffix property It makes sense to add the cpp.objectSuffix property to the base CppModule due the following reasons: 1. It is possible that the user wants to change the extension for the generated object files, which makes working with Qbs more flexible. 2. It will be easier to write an autotests that check the generation of the object files for a bare metal platforms, where object files can have various extensions such as ".rel", ".r90", ".r43", and so forth. Change-Id: Ib73836d5e614a6924d312d061f02437c3b318785 Reviewed-by: Christian Kandeler --- share/qbs/module-providers/Qt/templates/core.qbs | 2 +- share/qbs/modules/cpp/CppModule.qbs | 1 + share/qbs/modules/cpp/GenericGCC.qbs | 4 ++-- share/qbs/modules/cpp/iar.qbs | 3 +-- share/qbs/modules/cpp/keil.qbs | 2 +- share/qbs/modules/cpp/sdcc.qbs | 3 +-- share/qbs/modules/cpp/windows-mingw.qbs | 2 +- share/qbs/modules/cpp/windows-msvc-base.qbs | 9 +++++---- 8 files changed, 13 insertions(+), 13 deletions(-) (limited to 'share/qbs') diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index 8f0b0e2df..19c2d0239 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -445,7 +445,7 @@ Module { Rule { inputs: ["intermediate_obj"] Artifact { - filePath: input.completeBaseName + ".2.o" + filePath: input.completeBaseName + ".2" + input.cpp.objectSuffix fileTags: ["obj"] } prepare: { diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index ca89bbd63..61c9c3f65 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -186,6 +186,7 @@ Module { property string debugInfoBundleSuffix: "" property string variantSuffix: "" property string dynamicLibraryImportSuffix: ".lib" + property string objectSuffix: ".o" 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 50744f492..3b6e5b106 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -608,7 +608,7 @@ CppModule { return [{ fileTags: tags, filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), - input.fileName + ".o") + input.fileName + input.cpp.objectSuffix) }]; } @@ -623,7 +623,7 @@ CppModule { Artifact { fileTags: ["obj"] - filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + ".o") + filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + input.cpp.objectSuffix) } prepare: { diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs index 26f7b96f3..6c00f8f36 100644 --- a/share/qbs/modules/cpp/iar.qbs +++ b/share/qbs/modules/cpp/iar.qbs @@ -88,8 +88,7 @@ CppModule { staticLibrarySuffix: IAR.staticLibrarySuffix(qbs) executableSuffix: IAR.executableSuffix(qbs) - - property string objectSuffix: IAR.objectSuffix(qbs) + objectSuffix: IAR.objectSuffix(qbs) imageFormat: IAR.imageFormat(qbs) diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index 66233fc84..aa4eaadf9 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -89,8 +89,8 @@ CppModule { staticLibrarySuffix: KEIL.staticLibrarySuffix(qbs) executableSuffix: KEIL.executableSuffix(qbs) + objectSuffix: KEIL.objectSuffix(qbs) - property string objectSuffix: KEIL.objectSuffix(qbs) property string mapFileSuffix: KEIL.mapFileSuffix(qbs) imageFormat: KEIL.imageFormat(qbs) diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs index a44cee808..8b631d4e5 100644 --- a/share/qbs/modules/cpp/sdcc.qbs +++ b/share/qbs/modules/cpp/sdcc.qbs @@ -89,8 +89,7 @@ CppModule { staticLibrarySuffix: ".lib" executableSuffix: ".ihx" - - property string objectSuffix: ".rel" + objectSuffix: ".rel" imageFormat: "ihx" diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs index ffed76cdd..ef2ef4946 100644 --- a/share/qbs/modules/cpp/windows-mingw.qbs +++ b/share/qbs/modules/cpp/windows-mingw.qbs @@ -68,7 +68,7 @@ MingwBaseModule { auxiliaryInputs: ["hpp"] Artifact { - filePath: Utilities.getHash(input.baseDir) + "/" + input.completeBaseName + "_res.o" + filePath: Utilities.getHash(input.baseDir) + "/" + input.completeBaseName + "_res" + input.cpp.objectSuffix fileTags: ["obj"] } diff --git a/share/qbs/modules/cpp/windows-msvc-base.qbs b/share/qbs/modules/cpp/windows-msvc-base.qbs index c103ee691..97ba7c64f 100644 --- a/share/qbs/modules/cpp/windows-msvc-base.qbs +++ b/share/qbs/modules/cpp/windows-msvc-base.qbs @@ -88,6 +88,7 @@ CppModule { dynamicLibrarySuffix: ".dll" executableSuffix: ".exe" debugInfoSuffix: ".pdb" + objectSuffix: ".obj" imageFormat: "pe" Properties { condition: product.multiplexByQbsProperties.contains("buildVariants") @@ -113,7 +114,7 @@ CppModule { auxiliaryInputs: ["hpp"] Artifact { fileTags: ['obj'] - filePath: Utilities.getHash(input.completeBaseName) + '_c.obj' + filePath: Utilities.getHash(input.completeBaseName) + '_c' + input.cpp.objectSuffix } Artifact { fileTags: ['c_pch'] @@ -131,7 +132,7 @@ CppModule { auxiliaryInputs: ["hpp"] Artifact { fileTags: ['obj'] - filePath: Utilities.getHash(input.completeBaseName) + '_cpp.obj' + filePath: Utilities.getHash(input.completeBaseName) + '_cpp' + input.cpp.objectSuffix } Artifact { fileTags: ['cpp_pch'] @@ -156,7 +157,7 @@ CppModule { var artifacts = []; artifacts.push({ fileTags: tags, - filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".obj" + filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + input.cpp.objectSuffix }); if (input.cpp.generateCompilerListingFiles) { artifacts.push({ @@ -326,7 +327,7 @@ CppModule { Rule { inputs: ["asm"] Artifact { - filePath: Utilities.getHash(input.baseDir) + "/" + input.completeBaseName + ".obj" + filePath: Utilities.getHash(input.baseDir) + "/" + input.completeBaseName + input.cpp.objectSuffix fileTags: ["obj"] } prepare: { -- cgit v1.2.1