aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/cpp/windows-mingw.qbs
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-07-22 15:51:50 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-08-14 11:44:51 +0000
commit18a3b64ab07ade6bfc9bb068956beed2032d9b58 (patch)
tree7bcb18c36f05508457074d783197cdd3f37f9fd6 /share/qbs/modules/cpp/windows-mingw.qbs
parent5320c8578b600081d9c5174f4024b726c5bdefa0 (diff)
C++: Add support for clang on Windows
This is about clang in "mingw mode", not clang-cl. When targeting Windows, clang is a lot like mingw, so factor out the common parts into a new base module. Testing uncovered a number of invalid assumptions in our autotests, which are also fixed in this patch. In addition, minor adjustments had to be made to the Qt.core module and to the qbscore lib. Change-Id: I73085dc62a65e2a9d0397cf234c8641989246f22 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/windows-mingw.qbs')
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs88
1 files changed, 10 insertions, 78 deletions
diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs
index 27382742f..fe9fd4bf8 100644
--- a/share/qbs/modules/cpp/windows-mingw.qbs
+++ b/share/qbs/modules/cpp/windows-mingw.qbs
@@ -28,39 +28,28 @@
**
****************************************************************************/
+import qbs.File
+import qbs.FileInfo
import qbs.ModUtils
-import qbs.TextFile
import qbs.Utilities
-import qbs.WindowsUtils
import "setuprunenv.js" as SetupRunEnv
-GenericGCC {
+MingwBaseModule {
condition: qbs.targetOS.contains("windows") &&
qbs.toolchain && qbs.toolchain.contains("mingw")
priority: 0
- staticLibraryPrefix: "lib"
- staticLibrarySuffix: ".a"
- dynamicLibrarySuffix: ".dll"
- executableSuffix: ".exe"
- debugInfoSuffix: ".debug"
- imageFormat: "pe"
- windowsApiCharacterSet: "unicode"
- platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet))
- .concat("WIN32")
+
probeEnv: buildEnv
- Properties {
- condition: product.multiplexByQbsProperties.contains("buildVariants")
- && qbs.buildVariants && qbs.buildVariants.length > 1
- && qbs.buildVariant !== "release"
- && product.type.containsAny(["staticlibrary", "dynamiclibrary"])
- variantSuffix: "d"
+ property string windresName: "windres" + compilerExtension
+ property path windresPath: {
+ var filePath = toolchainPrefix + windresName;
+ if (!File.exists(filePath))
+ filePath = FileInfo.joinPaths(toolchainInstallPath, windresName);
+ return filePath;
}
- property string windresName: 'windres'
- property path windresPath: { return toolchainPathPrefix + windresName }
-
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", product.qbs.pathListSeparator, true);
v.prepend(product.cpp.toolchainInstallPath);
@@ -74,63 +63,6 @@ GenericGCC {
SetupRunEnv.setupRunEnvironment(product, config);
}
- FileTagger {
- patterns: ["*.manifest"]
- fileTags: ["native.pe.manifest"]
- }
-
- Rule {
- inputs: ["native.pe.manifest"]
- multiplex: true
-
- outputFileTags: ["rc"]
- outputArtifacts: {
- if (product.type.containsAny(["application", "dynamiclibrary"])) {
- return [{
- filePath: input.completeBaseName + ".rc",
- fileTags: ["rc"]
- }];
- }
- return [];
- }
-
- prepare: {
- var inputList = inputs["native.pe.manifest"];
- // TODO: Emulate manifest merging like Microsoft's mt.exe tool does
- if (inputList.length !== 1) {
- throw("The MinGW toolchain does not support manifest merging; " +
- "you may only specify a single manifest file to embed into your assembly.");
- }
-
- var cmd = new JavaScriptCommand();
- cmd.silent = true;
- cmd.productType = product.type;
- cmd.inputFilePath = inputList[0].filePath;
- cmd.outputFilePath = output.filePath;
- cmd.sourceCode = function() {
- var tf;
- try {
- tf = new TextFile(outputFilePath, TextFile.WriteOnly);
- if (productType.contains("application"))
- tf.write("1 "); // CREATEPROCESS_MANIFEST_RESOURCE_ID
- else if (productType.contains("dynamiclibrary"))
- tf.write("2 "); // ISOLATIONAWARE_MANIFEST_RESOURCE_ID
- tf.write("24 "); // RT_MANIFEST
- tf.writeLine(Utilities.cStringQuote(inputFilePath));
- } finally {
- if (tf)
- tf.close();
- }
- };
- return [cmd];
- }
- }
-
- FileTagger {
- patterns: ["*.rc"]
- fileTags: ["rc"]
- }
-
Rule {
inputs: ["rc"]
auxiliaryInputs: ["hpp"]