From bd97ecd3f617b21fa56a2717abcf76518697b1e3 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 13 Sep 2017 18:10:18 +0200 Subject: Cleanup skipBuild code Move all skipBuild related checks to runConfigure() in configure.prf. Remove some unused functions. Move platform checks to separate prf file. Change-Id: Ia45c837c91c341ed1fbc2e32fc098329da989920 Reviewed-by: Allan Sandfeld Jensen --- mkspecs/features/configure.prf | 31 ++++--- mkspecs/features/functions.prf | 185 +++-------------------------------------- mkspecs/features/platform.prf | 150 +++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+), 183 deletions(-) create mode 100644 mkspecs/features/platform.prf (limited to 'mkspecs') diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf index e21767565..ed6fe6c15 100644 --- a/mkspecs/features/configure.prf +++ b/mkspecs/features/configure.prf @@ -1,9 +1,28 @@ # Load configure.prf from qtbase first load(configure) load(functions) +load(platform) defineTest(runConfigure) { webengine_successfully_configured: return(true) + + !exists(src/3rdparty/chromium) { + skipBuild("Submodule qtwebengine-chromium does not exist. Run 'git submodule update --init'.") + return(false) + } + + WSPC = $$find(OUT_PWD, \\s) + !isEmpty(WSPC) { + skipBuild("QtWebEngine cannot be built in a path that contains whitespace characters.") + return(false) + } + + !isPlatformSupported() { + # make sure we have skipBuildReason + isEmpty(skipBuildReason): skipBuild("Unknow error. Platform unspported") + return(false) + } + linux:contains(QT_CONFIG,no-pkg-config) { skipBuild("pkg-config is required") return(false) @@ -46,12 +65,8 @@ defineTest(runConfigure) { !contains(WEBENGINE_CONFIG, use_system_ffmpeg): WEBENGINE_CONFIG += use_bundled_ffmpeg !contains(WEBENGINE_CONFIG, use_system_icu): WEBENGINE_CONFIG += use_bundled_icu - isQtMinimum(5, 9) { - qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code - optimize_size: WEBENGINE_CONFIG += reduce_binary_size - } else { - qtConfig(embedded): WEBENGINE_CONFIG += reduce_binary_size - } + qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code + optimize_size: WEBENGINE_CONFIG += reduce_binary_size sanitizer: !qtConfig(webengine-sanitizer) { skipBuild("Chosen sanitizer configuration is not supported. Use --feature-webengine-sanitizer=yes to force build with the chosen sanitizer configuration.") @@ -119,10 +134,6 @@ defineTest(runConfigure) { } } - win32:!qtConfig(winversion) { - skipBuild("Needs VS 2015 Update 3 with Cumulative Servicing Release or higher") - } - isEmpty(skipBuildReason) { cache(CONFIG, add, $$list(webengine_successfully_configured)) !isEmpty(WEBENGINE_CONFIG) { diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf index ed527d4f2..cdb826d98 100644 --- a/mkspecs/features/functions.prf +++ b/mkspecs/features/functions.prf @@ -1,176 +1,3 @@ -defineTest(isQtMinimum) { - !equals(QT_MAJOR_VERSION, $$1): return(false) - count(ARGS, 1, greaterThan) { - lessThan(QT_MINOR_VERSION, $$2): return(false) - } - return(true) -} - -!isQtMinimum(5, 8) { - defineTest(qtConfig) { - contains(QT_CONFIG, $$1): return(true) - return(false) - } -} - -defineTest(isPlatformSupported) { - QT_FOR_CONFIG += gui-private - linux { - if(!gcc:!clang)|intel_icc { - skipBuild("Qt WebEngine on Linux requires clang or GCC.") - return(false) - } - gcc:!clang:!isGCCVersionSupported(): return(false) - } else:win32 { - winrt { - skipBuild("WinRT is not supported.") - return(false) - } - isBuildingOnWin32() { - skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.") - } - !msvc|intel_icl { - skipBuild("Qt WebEngine on Windows requires MSVC.") - return(false) - } - !isMinWinSDKVersion(10, 10586): { - skipBuild("Qt WebEngine on Windows requires a Windows SDK version 10.0.10586 or newer.") - return(false) - } - } else:osx { - lessThan(QMAKE_XCODE_VERSION, 7.3) { - skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 7.3 is required to build Qt WebEngine.") - return(false) - } - !clang|intel_icc { - skipBuild("Qt WebEngine on macOS requires Clang.") - return(false) - } - # We require macOS 10.11 (darwin version 15.0.0) or newer. - darwin_major_version = $$section(QMAKE_HOST.version, ., 0, 0) - lessThan(darwin_major_version, 15) { - skipBuild("Building Qt WebEngine requires macOS version 10.11 or newer.") - return(false) - } - !isMinOSXSDKVersion(10, 10): { - skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.11 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) - } - - !contains(QT_CONFIG, c++11) { - skipBuild("C++11 support is required in order to build chromium.") - return(false) - } - qtConfig(mirclient) { - skipBuild("Mir is not yet supported as graphics backend for Qt WebEngine.") - return(false) - } - static { - skipBuild("Static builds of QtWebEngine aren't supported.") - return(false) - } - !isArchSupported(): return(false) - return(true) -} - -defineTest(isArchSupported) { - contains(QT_ARCH, "i386")|contains(QT_ARCH, "x86_64"): return(true) - contains(QT_ARCH, "arm")|contains(QT_ARCH, "arm64"): return(true) - contains(QT_ARCH, "mips"): return(true) -# contains(QT_ARCH, "mips64"): return(true) - - skipBuild("QtWebEngine can only be built for x86, x86-64, ARM, Aarch64, and MIPSel architectures.") - return(false) -} - -defineTest(isGCCVersionSupported) { - # The below will work for gcc 4.7 and up and also match gcc 5 - greaterThan(QT_GCC_MINOR_VERSION, 6):return(true) - greaterThan(QT_GCC_MAJOR_VERSION, 4):return(true) - - skipBuild("Using gcc version "$$QT_GCC_MAJOR_VERSION"."$$QT_GCC_MINOR_VERSION", but at least gcc version 4.7 is required to build Qt WebEngine.") - return(false) -} - -defineTest(isDeveloperBuild) { - qtConfig(private_tests): return(true) # enabled for developer-build - return(false) -} - -defineTest(isQMLTestSupportApiEnabled) { - isDeveloperBuild(): return(true) - contains(QT_BUILD_PARTS, tests): return(true) - contains(WEBENGINE_CONFIG, testsupport): return(true) - return(false) -} - -defineTest(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(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) { - skipBuild("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(isMinWinSDKVersion) { - requested_major = $$1 - requested_minor = $$2 - WIN_SDK_VERSION = $$(WindowsSDKVersion) - - isEmpty(WIN_SDK_VERSION)|equals(WIN_SDK_VERSION, "\\") { - skipBuild("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) -} - -# Map to the correct target type for gyp -defineReplace(toGypTargetType) { - equals(TEMPLATE, "app"):return("executable") - equals(TEMPLATE, "lib") { - CONFIG(static): return("static_library") - return("shared_library") - } - return("none") -} - defineReplace(getConfigDir) { win32:contains(QMAKE_TARGET.arch, x86_64) { CONFIG(release, debug|release):return("Release_x64") @@ -289,6 +116,18 @@ defineReplace(gnOS) { return(unknown) } +defineTest(isDeveloperBuild) { + qtConfig(private_tests): return(true) # enabled for developer-build + return(false) +} + +defineTest(isQMLTestSupportApiEnabled) { + isDeveloperBuild(): return(true) + contains(QT_BUILD_PARTS, tests): return(true) + contains(WEBENGINE_CONFIG, testsupport): return(true) + return(false) +} + defineTest(skipBuild) { skipBuildReason = "$$skipBuildReason $${EOL}$$1" export(skipBuildReason) diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf new file mode 100644 index 000000000..0b0bb6746 --- /dev/null +++ b/mkspecs/features/platform.prf @@ -0,0 +1,150 @@ +include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri) +QT_FOR_CONFIG += webengine-private + +defineTest(isQtMinimum) { + !equals(QT_MAJOR_VERSION, $$1): return(false) + count(ARGS, 1, greaterThan) { + lessThan(QT_MINOR_VERSION, $$2): return(false) + } + 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) + } + gcc:!clang:!isGCCVersionSupported(): return(false) + } else:win32 { + winrt { + skipBuild("WinRT is not supported.") + return(false) + } + isBuildingOnWin32() { + skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.") + } + !msvc|intel_icl { + skipBuild("Qt WebEngine on Windows requires MSVC.") + return(false) + } + !isMinWinSDKVersion(10, 10586): { + skipBuild("Qt WebEngine on Windows requires a Windows SDK version 10.0.10586 or newer.") + return(false) + } + !qtConfig(winversion) { + skipBuild("Needs VS 2015 Update 3 with Cumulative Servicing Release or higher") + return(false) + } + } else:osx { + lessThan(QMAKE_XCODE_VERSION, 7.3) { + skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 7.3 is required to build Qt WebEngine.") + return(false) + } + !clang|intel_icc { + skipBuild("Qt WebEngine on macOS requires Clang.") + return(false) + } + # We require macOS 10.11 (darwin version 15.0.0) or newer. + darwin_major_version = $$section(QMAKE_HOST.version, ., 0, 0) + lessThan(darwin_major_version, 15) { + skipBuild("Building Qt WebEngine requires macOS version 10.11 or newer.") + return(false) + } + !isMinOSXSDKVersion(10, 10): { + skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.11 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) + } + + !contains(QT_CONFIG, c++11) { + skipBuild("C++11 support is required in order to build chromium.") + return(false) + } + qtConfig(mirclient) { + skipBuild("Mir is not yet supported as graphics backend for Qt WebEngine.") + return(false) + } + static { + skipBuild("Static builds of QtWebEngine aren't supported.") + return(false) + } + !isArchSupported(): return(false) + return(true) +} + +defineTest(isArchSupported) { + contains(QT_ARCH, "i386")|contains(QT_ARCH, "x86_64"): return(true) + contains(QT_ARCH, "arm")|contains(QT_ARCH, "arm64"): return(true) + contains(QT_ARCH, "mips"): return(true) +# contains(QT_ARCH, "mips64"): return(true) + + skipBuild("QtWebEngine can only be built for x86, x86-64, ARM, Aarch64, and MIPSel architectures.") + return(false) +} + +defineTest(isGCCVersionSupported) { + # The below will work for gcc 4.7 and up and also match gcc 5 + greaterThan(QT_GCC_MINOR_VERSION, 6):return(true) + greaterThan(QT_GCC_MAJOR_VERSION, 4):return(true) + + skipBuild("Using gcc version "$$QT_GCC_MAJOR_VERSION"."$$QT_GCC_MINOR_VERSION", but at least gcc version 4.7 is required to build Qt WebEngine.") + return(false) +} + +defineTest(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(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) { + skipBuild("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(isMinWinSDKVersion) { + requested_major = $$1 + requested_minor = $$2 + WIN_SDK_VERSION = $$(WindowsSDKVersion) + + isEmpty(WIN_SDK_VERSION)|equals(WIN_SDK_VERSION, "\\") { + skipBuild("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) +} -- cgit v1.2.3