From f03cd06d89ceba2b99ffb9c4ca911dc01f0bdb08 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 22 Aug 2019 09:28:13 +0200 Subject: Refactor platform checks This simply rewrites isPlatformSupported to be easier to read. Task-number: QTBUG-75840 Task-number: QTBUG-76606 Change-Id: I3aab893f2f6db88928eda00d0db650150c7ccf2c Reviewed-by: Allan Sandfeld Jensen --- mkspecs/features/functions.prf | 13 ++++++- mkspecs/features/platform.prf | 81 ++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf index a301929dc..ec78a59cb 100644 --- a/mkspecs/features/functions.prf +++ b/mkspecs/features/functions.prf @@ -103,6 +103,12 @@ defineTest(skipBuild) { } defineTest(isWebEngineCoreBuild) { + + static{ + skipBuild("Static builds of QtWebEngine aren't supported.") + return(false) + } + !qtHaveModule(gui) { skipBuild("QtWebEngine requires QtGui.") return(false) @@ -121,7 +127,12 @@ defineTest(isWebEngineCoreBuild) { !isPlatformSupported() { # make sure we have skipBuildReason - isEmpty(skipBuildReason): skipBuild("Unknow error. Platform unspported") + isEmpty(skipBuildReason): skipBuild("Unknow error. Platform unspported.") + return(false) + } + + !isArchSupported() { + isEmpty(skipBuildReason): skipBuild("Unknown error. Architecture unsupported.") return(false) } diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf index 97cf96a78..23260cc79 100644 --- a/mkspecs/features/platform.prf +++ b/mkspecs/features/platform.prf @@ -9,40 +9,48 @@ defineTest(isQtMinimum) { return(true) } -defineTest(isPlatformSupported) { - QT_FOR_CONFIG += gui-private - linux { - if(!gcc:!clang)|intel_icc { - skipBuild("Qt WebEngine on Linux requires clang or GCC.") - return(false) +defineTest(isLinuxPlatformSupported) { + !gcc|intel_icc { + skipBuild("Qt WebEngine on Linux requires clang or GCC.") + return(false) } gcc:!clang:!isGCCVersionSupported(): return(false) - } else:win32 { + gcc:!contains(QT_CONFIG, c++14) { + skipBuild("C++14 support is required in order to build chromium.") + return(false) + } + return(true) +} + +defineTest(isWindowsPlatformSupported) { winrt { - skipBuild("WinRT is not supported.") - return(false) + skipBuild("WinRT is not supported.") + return(false) } isBuildingOnWin32() { - skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.") - return(false) + skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.") + return(false) } !msvc|intel_icl { - skipBuild("Qt WebEngine on Windows requires MSVC or Clang (MSVC mode).") - return(false) + skipBuild("Qt WebEngine on Windows requires MSVC or Clang (MSVC mode).") + return(false) } !isMinWinSDKVersion(10, 17763): { - skipBuild("Qt WebEngine on Windows requires a Windows SDK version 10.0.17763 or newer.") - return(false) + skipBuild("Qt WebEngine on Windows requires a Windows SDK version 10.0.17763 or newer.") + return(false) } !qtConfig(webengine-winversion) { - skipBuild("Needs Visual Studio 2017 or higher") - return(false) + skipBuild("Needs Visual Studio 2017 or higher") + return(false) } - } else:osx { + return(true) +} + +defineTest(isMacOsPlatformSupported) { # FIXME: Try to get it back down to 8.2 for building on OS X 10.11 !isMinXcodeVersion(8, 3, 3) { - skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.") - return(false) + skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.") + return(false) } !clang|intel_icc { skipBuild("Qt WebEngine on macOS requires Clang.") @@ -51,29 +59,26 @@ defineTest(isPlatformSupported) { # 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) { - skipBuild("Building Qt WebEngine requires macOS version 10.12 or newer.") - return(false) + skipBuild("Building Qt WebEngine requires macOS version 10.12 or newer.") + return(false) } !isMinOSXSDKVersion(10, 12): { - skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.") - return(false) + skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.") + return(false) } - } else { - skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.") - return(false) - } + return(true) +} - # QMAKE doesn't set c++14 for MSVC2017, so only test for gcc and clang (which pretends to be gcc) - gcc:!contains(QT_CONFIG, c++14) { - skipBuild("C++14 support is required in order to build chromium.") - return(false) - } - static { - skipBuild("Static builds of QtWebEngine aren't supported.") +defineTest(isPlatformSupported) { + QT_FOR_CONFIG += gui-private + !linux:!win32:!macos { + skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.") + return(false) + } + linux:isLinuxPlatformSupported(): return(true) + win32:isWindowsPlatformSupported(): return(true) + macos:isMacOsPlatformSupported(): return(true) return(false) - } - !isArchSupported(): return(false) - return(true) } defineTest(isArchSupported) { -- cgit v1.2.3