diff options
Diffstat (limited to 'tools/qmake/mkspecs/features/functions.prf')
-rw-r--r-- | tools/qmake/mkspecs/features/functions.prf | 172 |
1 files changed, 149 insertions, 23 deletions
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index c8fd278b4..236ee8ac5 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -1,4 +1,20 @@ +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 { !gcc:!clang { skipBuild("Qt WebEngine on Linux requires clang or GCC.") @@ -11,20 +27,24 @@ defineTest(isPlatformSupported) { return(false) } msvc { - !equals(MSVC_VER, "12.0"):!equals(MSVC_VER, "14.0") { - skipBuild("Qt WebEngine on Windows requires MSVC 2013 or MSVC 2015.") + !equals(MSVC_VER, "14.0") { + skipBuild("Qt WebEngine on Windows requires MSVC 2015 Update 2 or later.") return(false) } } else { - skipBuild("Qt WebEngine on Windows requires MSVC 2013 or MSVC 2015.") + skipBuild("Qt WebEngine on Windows requires MSVC 2015 Update 2 or later.") return(false) } isBuildingOnWin32() { skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.") } + !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, 6.1) { - skipBuild("Using XCode version $$QMAKE_XCODE_VERSION, but at least version 6.1 is required to build Qt WebEngine.") + lessThan(QMAKE_XCODE_VERSION, 5.1) { + skipBuild("Using XCode version $$QMAKE_XCODE_VERSION, but at least version 5.1 is required to build Qt WebEngine.") return(false) } # We require OS X 10.9 (darwin version 13.0.0) or newer @@ -46,7 +66,7 @@ defineTest(isPlatformSupported) { skipBuild("C++11 support is required in order to build chromium.") return(false) } - contains(QT_CONFIG, mirclient) { + qtConfig(mirclient) { skipBuild("Mir is not yet supported as graphics backend for Qt WebEngine.") return(false) } @@ -56,6 +76,7 @@ defineTest(isPlatformSupported) { } !isPythonVersionSupported(): return(false) !isArchSupported(): return(false) + isSanitizerEnabled():!isSanitizerSupported():!forceSanitizerBuild(): return(false) return(true) } @@ -87,6 +108,106 @@ defineTest(isPythonVersionSupported) { return(false) } +defineTest(isSanitizerEnabled) { + sanitize_address|sanitize_memory|sanitize_undefined|sanitize_thread: return(true) + return(false) +} + +defineTest(forceSanitizerBuild) { + contains(WEBENGINE_CONFIG, force_sanitizer_build): return(true) + skipBuild("Chosen sanitizer configuration is not supported. Use WEBENGINE_CONFIG+=force_sanitizer_build to force build with the chosen sanitizer configuration.") + return(false) +} + +defineTest(isSanitizerSupported) { + sanitizer_combo_supported = true + sanitize_address { + asan_supported = false + linux-clang-libc++:isSanitizerSupportedOnLinux() { + asan_supported = true + } else:macos:isSanitizerSupportedOnMacOS() { + asan_supported = true + } + !$$asan_supported { + sanitizer_combo_supported = false + warning("An address sanitizer-enabled Qt WebEngine build can only be built on Linux or macOS using Clang and libc++.") + } + } + + sanitize_memory { + sanitizer_combo_supported = false + warning("A memory sanitizer-enabled Qt WebEngine build is not supported.") + } + + sanitize_undefined { + ubsan_supported = false + linux-clang-libc++:isSanitizerSupportedOnLinux():CONFIG(release, debug|release):!debug_and_release { + ubsan_supported = true + } + !$$ubsan_supported { + sanitizer_combo_supported = false + warning("An undefined behavior sanitizer-enabled Qt WebEngine build can only be built on Linux using Clang and libc++ in release mode.") + } + } + + sanitize_thread { + tsan_supported = false + linux-clang-libc++:isSanitizerSupportedOnLinux() { + tsan_supported = true + } + !$$tsan_supported { + sanitizer_combo_supported = false + warning("A thread sanitizer-enabled Qt WebEngine build can only be built on Linux using Clang and libc++.") + } + } + + $$sanitizer_combo_supported: return(true) + return(false) +} + +defineTest(isSanitizerSupportedOnLinux) { + isSanitizerLinuxClangVersionSupported(): return(true) + return(false) +} + +defineTest(isSanitizerSupportedOnMacOS) { + isEmpty(QT_APPLE_CLANG_MAJOR_VERSION) { + QTWEBENGINE_CLANG_IS_APPLE = false + } else { + QTWEBENGINE_CLANG_IS_APPLE = true + } + $$QTWEBENGINE_CLANG_IS_APPLE:isSanitizerMacOSAppleClangVersionSupported(): return(true) + else:isSanitizerMacOSClangVersionSupported(): return(true) + return(false) +} + +defineTest(isSanitizerMacOSAppleClangVersionSupported) { + # Clang sanitizer suppression attributes work from Apple Clang version 7.3.0+. + greaterThan(QT_APPLE_CLANG_MAJOR_VERSION, 7): return(true) + greaterThan(QT_APPLE_CLANG_MINOR_VERSION, 2): return(true) + + warning("Using Apple Clang version $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}.$${QT_APPLE_CLANG_PATCH_VERSION}, but at least Apple Clang version 7.3.0 is required to build a sanitizer-enabled Qt WebEngine.") + return(false) +} + +defineTest(isSanitizerMacOSClangVersionSupported) { + # Clang sanitizer suppression attributes work from non-apple Clang version 3.7+. + greaterThan(QT_CLANG_MAJOR_VERSION, 3): return(true) + greaterThan(QT_CLANG_MINOR_VERSION, 6): return(true) + + warning("Using Clang version $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}, but at least Clang version 3.7 is required to build a sanitizer-enabled Qt WebEngine.") + return(false) +} + +defineTest(isSanitizerLinuxClangVersionSupported) { + # Clang sanitizer suppression attributes work from Clang version 3.7+. + greaterThan(QT_CLANG_MAJOR_VERSION, 3): return(true) + greaterThan(QT_CLANG_MINOR_VERSION, 6): return(true) + + warning("Using Clang version $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}, but at least Clang version 3.7 is required to build a sanitizer-enabled Qt WebEngine.") + 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) @@ -96,7 +217,7 @@ defineTest(isGCCVersionSupported) { } defineTest(isQMLTestSupportApiEnabled) { - contains(QT_CONFIG, private_tests): return(true) # enable for developer-build + qtConfig(private_tests): return(true) # enable for developer-build contains(QT_BUILD_PARTS, tests): return(true) contains(WEBENGINE_CONFIG, testsupport): return(true) return(false) @@ -134,6 +255,22 @@ defineTest(isMinOSXSDKVersion) { return(false) } +defineTest(isMinWinSDKVersion) { + requested_major = $$1 + requested_minor = $$2 + WIN_SDK_VERSION = $$(WindowsSDKVersion) + + # 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") @@ -238,28 +375,17 @@ defineReplace(findOrBuildNinja) { !exists($$out) { src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT") - out = $$shadowed($$absolute_path("ninja/ninja", "$$src_3rd_party_dir")) + out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir)) win32: out = $${out}.exe - out = $$system_path($$out) # If we did not find ninja, then we bootstrap it. !exists($$out) { - # If we are making a shadow build, copy the ninja sources to the build directory. - !equals(PWD, $${OUT_PWD}) { - log("Build directory is different from source directory - copying ninja sources to the build tree...") - shadow_3rd_party_path = $$system_path($$shadowed($$src_3rd_party_dir)) - - !exists($$dirname(out)): mkpath($$dirname(out)) - copy_dir_files { - system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$dirname(out))") - } else { - system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)") - } - } - system("cd $$system_quote($$dirname(out)) && python configure.py --bootstrap") + mkpath($$dirname(out)) + ninja_configure = $$absolute_path(ninja/configure.py, $$src_3rd_party_dir) + system("cd $$system_quote($$system_path($$dirname(out))) && python $$system_quote($$system_path($$ninja_configure)) --bootstrap") } } - return($$out) + return($$system_path($$out)) } defineTest(skipBuild) { |