summaryrefslogtreecommitdiffstats
path: root/configure.pri
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2019-09-05 08:55:38 +0200
committerMichal Klocek <michal.klocek@qt.io>2019-09-19 09:52:44 +0200
commite29f450d7359c9390165268db8d9c6667c96ed96 (patch)
treef154ddaf3d88eabbb2ab38a7d98715b88b294f40 /configure.pri
parentd9bbf709cd0a2013833863a66396bc62f0165f48 (diff)
Clean up platform tests
Make it a private feature so test is not run twice. The better solution would be to split the platform test into separate tests in configure, but it looks like a lot of boring typing and would result in bunch on private features. Instead run test only on configure step and in case of fail just export the error, so it is reported during configure and make calls. Change-Id: Ice1188631a53fe739569de3e303533b18342941a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'configure.pri')
-rw-r--r--configure.pri171
1 files changed, 167 insertions, 4 deletions
diff --git a/configure.pri b/configure.pri
index b7bb0f34d..4728ec329 100644
--- a/configure.pri
+++ b/configure.pri
@@ -1,4 +1,4 @@
-include(src/buildtools/config/platform.pri)
+include(src/buildtools/config/support.pri)
include(src/buildtools/config/functions.pri)
# this must be done outside any function
@@ -102,12 +102,38 @@ defineTest(qtConfTest_detectBison) {
return(true)
}
+defineTest(qtwebengine_platformError) {
+ platformError = $$1
+ export(platformError)
+}
+
defineTest(qtConfTest_detectPlatform) {
- !qtwebengine_isPlatformSupported() {
+ QT_FOR_CONFIG += gui-private
+
+ !linux:!win32:!macos {
+ qtwebengine_platformError("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.")
+ } else {
+ linux:qtwebengine_isLinuxPlatformSupported() {
+ $${1}.platform = "linux"
+ }
+ win32:qtwebengine_isWindowsPlatformSupported() {
+ $${1}.platform = "windows"
+ }
+ macos:qtwebengine_isMacOsPlatformSupported() {
+ $${1}.platform = "macos"
+ }
+ }
+
+ !isEmpty(platformError) {
qtLog("Platform not supported.")
+ $${1}.platformSupport = $$platformError
+ export($${1}.platformSupport)
+ $${1}.cache += platformSupport
+ export($${1}.cache)
return(false)
- }
- return(true)
+ }
+ export($${1}.platformSupport)
+ return(true)
}
defineTest(qtConfTest_detectArch) {
@@ -361,3 +387,140 @@ defineTest(qtwebengine_confCheckError) {
QT_FOR_CONFIG += buildtools-private gui-private
return($$qtwebengine_checkError())
}
+
+defineTest(qtwebengine_isLinuxPlatformSupported) {
+ !gcc|intel_icc {
+ qtwebengine_platformError("Qt WebEngine on Linux requires clang or GCC.")
+ return(false)
+ }
+ gcc:!clang:!qtwebengine_isGCCVersionSupported(): return(false)
+ gcc:!qtConfig(c++14) {
+ qtwebengine_platformError("C++14 support is required in order to build chromium.")
+ return(false)
+ }
+ return(true)
+}
+
+defineTest(qtwebengine_isWindowsPlatformSupported) {
+ winrt {
+ qtwebengine_platformError("WinRT is not supported.")
+ return(false)
+ }
+ qtwebengine_isBuildingOnWin32() {
+ qtwebengine_platformError("Qt WebEngine on Windows must be built on a 64-bit machine.")
+ return(false)
+ }
+ !msvc|intel_icl {
+ qtwebengine_platformError("Qt WebEngine on Windows requires MSVC or Clang (MSVC mode).")
+ return(false)
+ }
+ !qtwebengine_isMinWinSDKVersion(10, 17763): {
+ qtwebengine_platformError("Qt WebEngine on Windows requires a Windows SDK version 10.0.17763 or newer.")
+ return(false)
+ }
+ return(true)
+}
+
+defineTest(qtwebengine_isMacOsPlatformSupported) {
+ # FIXME: Try to get it back down to 8.2 for building on OS X 10.11
+ !qtwebengine_isMinXcodeVersion(8, 3, 3) {
+ qtwebengine_platformError("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.")
+ return(false)
+ }
+ !clang|intel_icc {
+ qtwebengine_platformError("Qt WebEngine on macOS requires Clang.")
+ return(false)
+ }
+ # We require macOS 10.12 (darwin version 16.0.0) or newer.
+ darwin_major_version = $$section(QMAKE_HOST.version, ., 0, 0)
+ lessThan(darwin_major_version, 16) {
+ qtwebengine_platformError("Building Qt WebEngine requires macOS version 10.12 or newer.")
+ return(false)
+ }
+ !qtwebengine_isMinOSXSDKVersion(10, 12): {
+ qtwebengine_platformError("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+ return(false)
+ }
+ return(true)
+}
+
+defineTest(qtwebengine_isGCCVersionSupported) {
+ # Keep in sync with src/webengine/doc/src/qtwebengine-platform-notes.qdoc
+ greaterThan(QMAKE_GCC_MAJOR_VERSION, 4):return(true)
+
+ qtwebengine_platformError("Using gcc version "$$QMAKE_GCC_MAJOR_VERSION"."$$QMAKE_GCC_MINOR_VERSION", but at least gcc version 5 is required to build Qt WebEngine.")
+ return(false)
+}
+
+defineTest(qtwebengine_isBuildingOnWin32) {
+ # The check below is ugly, but necessary, as it seems to be the only reliable way to detect if the host
+ # architecture is 32 bit. QMAKE_HOST.arch does not work as it returns the architecture that the toolchain
+ # is building for, not the system's actual architecture.
+ PROGRAM_FILES_X86 = $$(ProgramW6432)
+ isEmpty(PROGRAM_FILES_X86): return(true)
+ return(false)
+}
+
+defineTest(qtwebengine_isMinOSXSDKVersion) {
+ requested_major = $$1
+ requested_minor = $$2
+ requested_patch = $$3
+ isEmpty(requested_patch): requested_patch = 0
+ WEBENGINE_OSX_SDK_PRODUCT_VERSION = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version ProductVersion 2>/dev/null")
+ export(WEBENGINE_OSX_SDK_PRODUCT_VERSION)
+ isEmpty(WEBENGINE_OSX_SDK_PRODUCT_VERSION) {
+ qtwebengine_platformError("Could not resolve SDK product version for \'$$QMAKE_MAC_SDK\'.")
+ return(false)
+ }
+ major_version = $$section(WEBENGINE_OSX_SDK_PRODUCT_VERSION, ., 0, 0)
+ minor_version = $$section(WEBENGINE_OSX_SDK_PRODUCT_VERSION, ., 1, 1)
+ patch_version = $$section(WEBENGINE_OSX_SDK_PRODUCT_VERSION, ., 2, 2)
+ isEmpty(patch_version): patch_version = 0
+
+ greaterThan(major_version, $$requested_major):return(true)
+ equals(major_version, $$requested_major):greaterThan(minor_version, $$requested_minor):return(true)
+ equals(major_version, $$requested_major):equals(minor_version, $$requested_minor):!lessThan(patch_version, $$requested_patch):return(true)
+
+ return(false)
+}
+
+defineTest(qtwebengine_isMinXcodeVersion) {
+ requested_major = $$1
+ requested_minor = $$2
+ requested_patch = $$3
+ isEmpty(requested_minor): requested_minor = 0
+ isEmpty(requested_patch): requested_patch = 0
+ target_var = QMAKE_XCODE_VERSION
+ major_version = $$section($$target_var, ., 0, 0)
+ minor_version = $$section($$target_var, ., 1, 1)
+ patch_version = $$section($$target_var, ., 2, 2)
+ isEmpty(minor_version): minor_version = 0
+ isEmpty(patch_version): patch_version = 0
+
+ greaterThan(major_version, $$requested_major):return(true)
+ equals(major_version, $$requested_major):greaterThan(minor_version, $$requested_minor):return(true)
+ equals(major_version, $$requested_major):equals(minor_version, $$requested_minor):!lessThan(patch_version, $$requested_patch):return(true)
+
+ return(false)
+}
+
+defineTest(qtwebengine_isMinWinSDKVersion) {
+ requested_major = $$1
+ requested_minor = $$2
+ WIN_SDK_VERSION = $$(WindowsSDKVersion)
+
+ isEmpty(WIN_SDK_VERSION)|equals(WIN_SDK_VERSION, "\\") {
+ qtwebengine_platformError("Could not detect Windows SDK version (\'WindowsSDKVersion\' environment variable is not set).")
+ return(false)
+ }
+
+ # major.0.minor
+ major_version = $$section(WIN_SDK_VERSION, ., 0, 0)
+ minor_version = $$section(WIN_SDK_VERSION, ., 2, 2)
+
+ greaterThan(major_version, $$requested_major):return(true)
+ equals(major_version, $$requested_major):greaterThan(minor_version, $$requested_minor):return(true)
+ equals(major_version, $$requested_major):equals(minor_version, $$requested_minor)::return(true)
+
+ return(false)
+}