aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-12-07 23:58:14 -0800
committerJake Petroules <jake.petroules@qt.io>2017-12-21 00:59:23 +0000
commit1a15ca43205966a5d0f94a5caaf240eb4df94e7f (patch)
tree0112be97a77078ddf98544b6ed165809a5c04657 /share
parent6ef95bd464caa313d7e56b01bf5322577aa66e0c (diff)
Automatically detect Windows cross-compilers when building for Windows
Task-number: QBS-1247 Change-Id: I604ba374378197a6a76cc0367f2511422c345791 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs36
1 files changed, 35 insertions, 1 deletions
diff --git a/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs b/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs
index af66ae0c3..4d87a0a81 100644
--- a/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs
@@ -9,7 +9,41 @@ BinaryProbe {
// Outputs
property string tcPrefix
- names: (_toolchainPrefix || "") + _compilerName
+ platformPaths: {
+ var paths = base;
+ if (qbs.targetOS.contains("windows") && qbs.hostOS.contains("windows"))
+ paths.push(FileInfo.joinPaths(
+ Environment.getEnv("SystemDrive"), "MinGW", "bin"));
+ return paths;
+ }
+
+ names: {
+ var prefixes = [];
+ if (_toolchainPrefix) {
+ prefixes.push(_toolchainPrefix);
+ } else {
+ var arch = qbs.architecture;
+ if (qbs.targetOS.contains("windows")) {
+ if (!arch || arch === "x86") {
+ prefixes.push("mingw32-",
+ "i686-w64-mingw32-",
+ "i686-w64-mingw32.shared-",
+ "i686-w64-mingw32.static-",
+ "i686-mingw32-",
+ "i586-mingw32msvc-");
+ }
+ if (!arch || arch === "x86_64") {
+ prefixes.push("x86_64-w64-mingw32-",
+ "x86_64-w64-mingw32.shared-",
+ "x86_64-w64-mingw32.static-",
+ "amd64-mingw32msvc-");
+ }
+ }
+ }
+ return prefixes.map(function(prefix) {
+ return prefix + _compilerName;
+ }).concat([_compilerName]);
+ }
configure: {
var result = PathProbeConfigure.configure(names, nameSuffixes, nameFilter, pathPrefixes,