From dd7c3f92c4668ed9ebdb1714d00de1cb61ab7dd4 Mon Sep 17 00:00:00 2001
From: Michal Klocek <michal.klocek@qt.io>
Date: Tue, 25 Sep 2018 13:09:43 +0200
Subject: [PATCH] Check if windows has 64 bit compiler

Task-number: QTBUG-68462
Task-number: QTBUG-70728
Change-Id: I4314bce427555504cb49de93af45c910de554479
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 configure.json                 | 15 +++++++++++++++
 configure.pri                  |  9 +++++++++
 mkspecs/features/configure.prf |  5 +++++
 3 files changed, 29 insertions(+)

diff --git a/configure.json b/configure.json
index 6cb7d3fbb..1c01c80ca 100644
--- a/configure.json
+++ b/configure.json
@@ -303,6 +303,10 @@
         "webengine-sanitizer": {
             "label" : "sanitizer support",
             "type": "isSanitizerSupported"
+        },
+        "webengine-win-compiler64": {
+            "label": "64bit compiler",
+            "type": "isWindowsHostCompiler64"
         }
     },
 
@@ -609,6 +613,12 @@
             "autoDetect": "config.sanitizer && tests.webengine-sanitizer",
             "condition": "config.sanitizer",
             "output": [ "privateFeature" ]
+        },
+        "webengine-win-compiler64": {
+            "label": "64bit compiler",
+            "condition": "config.win32 && tests.webengine-win-compiler64",
+            "type": "isWindowsHostCompiler64",
+            "output": [ "privateFeature" ]
         }
     },
 
@@ -642,6 +652,11 @@
             "type": "warning",
             "condition": "config.unix && !features.webengine-host-pkg-config",
             "message": "host pkg-config not found"
+        },
+        {
+            "type": "warning",
+            "condition": "config.win32 && !features.webengine-win-compiler64",
+            "message": "64-bit cross-building or native toolchain is required to build QtWebEngine."
         }
     ],
 
diff --git a/configure.pri b/configure.pri
index 82a7de227..735b1f734 100644
--- a/configure.pri
+++ b/configure.pri
@@ -260,3 +260,12 @@ defineReplace(qtConfFunc_isTestsInBuildParts) {
     contains(QT_BUILD_PARTS, tests): return(true)
     return(false)
 }
+
+defineTest(qtConfTest_isWindowsHostCompiler64) {
+    win_host_arch = $$(VSCMD_ARG_HOST_ARCH)
+    isEmpty(win_host_arch): return(true)
+    contains(win_host_arch,"x64"): return(true)
+    qtLog("Required 64-bit cross-building or native toolchain was not detected.")
+    return(false)
+}
+
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
index f8c154655..c3ae7df8d 100644
--- a/mkspecs/features/configure.prf
+++ b/mkspecs/features/configure.prf
@@ -37,6 +37,11 @@ defineTest(runConfigure) {
         return(false)
     }
 
+    win32:!qtConfig(webengine-win-compiler64) {
+        skipBuild("Required 64-bit cross-building or native toolchain could not be found.")
+        return(false)
+    }
+
     !qtConfig(webengine-gperf) {
         skipBuild("Required gperf could not be found.")
         return(false)
-- 
GitLab