defineTest(isPlatformSupported) { !win32-msvc2013: !contains(QT_CONFIG, c++11) { skipBuild("C++11 support is required in order to build chromium.") return(false) } static { skipBuild("Static builds of QtWebEngine aren't supported.") return(false) } osx: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) } linux-g++*:!isGCCVersionSupported(): return(false) !isPythonVersionSupported(): return(false) linux-g++*|win32-msvc2013|macx-clang: return(true) boot2qt: return(true) skipBuild("Qt WebEngine can currently only be built for Linux (GCC), Windows (MSVC 2013), OS X (XCode 5.1+) or Qt for Device Creation.") return(false) } defineTest(isPythonVersionSupported) { python_major_version = $$system('python -c "import sys; print sys.version_info.major"') python_minor_version = $$system('python -c "import sys; print sys.version_info.minor"') lessThan(python_major_version, 3): greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true) skipBuild("Using Python version "$$python_major_version"."$$python_minor_version", but Python version 2 (2.7 or later) is required to build 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) 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(isQMLTestSupportApiEnabled) { contains(QT_CONFIG, private_tests): return(true) # enable for developer-build contains(QT_BUILD_PARTS, tests): return(true) contains(WEBENGINE_CONFIG, testsupport): 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") return("Debug_x64") } CONFIG(release, debug|release):return("Release") return("Debug") } defineReplace(getChromiumSrcDir) { git_chromium_src_dir = $$system("git config qtwebengine.chromiumsrcdir") # Fall back to the snapshot path if git does not know about chromium sources (i.e. init-repository.py has not been used) isEmpty(git_chromium_src_dir): git_chromium_src_dir = "src/3rdparty/chromium" return($$git_chromium_src_dir) } defineReplace(extractCFlag) { CFLAGS = $$QMAKE_CC $$QMAKE_CFLAGS OPTION = $$find(CFLAGS, $$1) OPTION = $$split(OPTION, =) return ($$member(OPTION, 1)) } defineReplace(findMocables) { input = $$1 for (file, input): \ infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_) mocables = $$system("python $$QTWEBENGINE_ROOT/tools/buildscripts/find-mocables $$infiles") mocables = $$replace(mocables, $$re_escape($${_PRO_FILE_PWD_}/), '') return($$mocables) } defineReplace(findIncludedMocFiles) { input = $$1 for (file, input): \ infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_) return($$system("python $$QTWEBENGINE_ROOT/tools/buildscripts/find-included-moc-files $$infiles")) } defineReplace(mocOutput) { out = $$1 # The order is important, since the output of the second replace would end up accidentaly transformed by the first one for(ext, $$list($${QMAKE_EXT_CPP})): \ out = $$replace(out, ^(.*)($$re_escape($${ext})), $${QMAKE_CPP_MOD_MOC}\\1$${QMAKE_EXT_CPP_MOC}) for(ext, $$list($${QMAKE_EXT_H})): \ out = $$replace(out, ^(.*)($$re_escape($${ext})), $${QMAKE_H_MOD_MOC}\\1$${first(QMAKE_EXT_CPP)}) return($$out) } defineReplace(rccOutput) { out = $$1 out = $$replace(out, .qrc, .cpp) out = $$join(out, qrc_, qrc_) return($$out) } defineReplace(rccExternFunc) { out = $$1 out = $$replace(out, .qrc, ) return($$out) } defineReplace(which) { out = $$1 win32 { command = $$split(out, " ") executable = $$first(command) # Return the first match only out = $$system("((for /f \"usebackq delims=\" %i in (`where $$executable 2^> NUL`) do @if not defined _endwhich (@echo %i & set _endwhich=true)) & set _endwhich=)") isEmpty(out) { message($$executable not found) out = $$executable } for(arg, command): !equals(arg, $$executable): out += $$arg } else:unix { command = $$split(out, " ") executable = $$first(command) out = $$system("which $$executable 2>/dev/null") isEmpty(out) { message($$executable not found) out = $$executable } for(arg, command): !equals(arg, $$executable): out += $$arg } return($$out) } defineReplace(findOrBuildNinja) { # If NINJA_PATH env var is set, prefer that. # Fallback to locating our own bootstrapped ninja. out = $(NINJA_PATH) !exists($$out) { out = $$absolute_path("$${getChromiumSrcDir()}/../ninja/ninja", "$$QTWEBENGINE_ROOT") win32: out = $$system_path($${out}.exe) # If we did not find ninja, then we bootstrap it. !exists($$out): system("cd $$dirname(out) && python configure.py --bootstrap") } return($$out) } defineTest(skipBuild) { skipBuildReason = "$$skipBuildReason $${EOL}$$1" export(skipBuildReason) }