diff options
Diffstat (limited to 'share/qbs/modules/cpp/windows-mingw.qbs')
-rw-r--r-- | share/qbs/modules/cpp/windows-mingw.qbs | 88 |
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"] |