aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2021-03-28 18:21:15 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2021-03-30 13:58:27 +0000
commit119ae17573193dc81969e954f2dde47172437fa9 (patch)
treed067c8474dcbd56a6abdc98c17e6d74859a8b927
parent6dce3eae9f96a34c9bdf5e5df2dfbc0e2c4c6209 (diff)
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 <christian.kandeler@qt.io>
-rw-r--r--doc/reference/modules/cpp-module.qdoc8
-rw-r--r--share/qbs/module-providers/Qt/templates/core.qbs2
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs1
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs4
-rw-r--r--share/qbs/modules/cpp/iar.qbs3
-rw-r--r--share/qbs/modules/cpp/keil.qbs2
-rw-r--r--share/qbs/modules/cpp/sdcc.qbs3
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs2
-rw-r--r--share/qbs/modules/cpp/windows-msvc-base.qbs9
9 files changed, 21 insertions, 13 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc
index a3ea55867..e6d63eaf8 100644
--- a/doc/reference/modules/cpp-module.qdoc
+++ b/doc/reference/modules/cpp-module.qdoc
@@ -618,6 +618,14 @@
*/
/*!
+ \qmlproperty string cpp::objectSuffix
+
+ A string to append to the generated object files.
+
+ \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c ".o" or \c ".obj"
+*/
+
+/*!
\qmlproperty pathList cpp::prefixHeaders
\since Qbs 1.0.1
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: {