diff options
author | Michal Klocek <michal.klocek@qt.io> | 2019-08-14 12:38:32 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-09-07 19:53:32 +0000 |
commit | 19a73086082bdf99f6f7b3b389c5e3f0703de449 (patch) | |
tree | 1980b72be2356d0da96e7911c2cfe606346a3630 /src/buildtools/config | |
parent | 8684373c08a774a7ed23682a358de991b8775ddd (diff) |
Move gn configs out of core
Change-Id: Ib047e35191faa627211c759bff4e81bfaec3d685
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/buildtools/config')
-rw-r--r-- | src/buildtools/config/common.pri | 139 | ||||
-rw-r--r-- | src/buildtools/config/functions.pri | 8 | ||||
-rw-r--r-- | src/buildtools/config/linux.pri | 203 | ||||
-rw-r--r-- | src/buildtools/config/mac_osx.pri | 39 | ||||
-rw-r--r-- | src/buildtools/config/windows.pri | 89 |
5 files changed, 478 insertions, 0 deletions
diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri new file mode 100644 index 000000000..1a54f1559 --- /dev/null +++ b/src/buildtools/config/common.pri @@ -0,0 +1,139 @@ +# Shared configuration for all our supported platforms +include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri) +include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri) +QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private + +gn_args += \ + use_qt=true \ + closure_compile=false \ + is_component_build=false \ + is_shared=true \ + enable_message_center=false \ + enable_mus=false \ + enable_nacl=false \ + enable_remoting=false \ + enable_reporting=false \ + enable_resource_whitelist_generation=false \ + enable_swiftshader=false \ + enable_web_auth=false \ + enable_web_speech=false \ + enable_widevine=true \ + has_native_accessibility=false \ + enable_debugallocation=false \ + use_allocator_shim=false \ + use_allocator=\"none\" \ + use_custom_libcxx=false \ + v8_use_external_startup_data=false \ + toolkit_views=false \ + treat_warnings_as_errors=false \ + safe_browsing_mode=0 \ + optimize_webui=false + +greaterThan(QMAKE_JUMBO_MERGE_LIMIT,0) { + gn_args += \ + use_jumbo_build=true \ + jumbo_file_merge_limit=$$QMAKE_JUMBO_MERGE_LIMIT +} + +!greaterThan(QMAKE_JUMBO_MERGE_LIMIT,8) { + gn_args += jumbo_build_excluded="[\"browser\"]" +} + +qtConfig(webengine-printing-and-pdf) { + gn_args += enable_basic_printing=true enable_print_preview=true + gn_args += enable_pdf=true +} else { + gn_args += enable_basic_printing=false enable_print_preview=false + gn_args += enable_pdf=false +} + +qtConfig(webengine-pepper-plugins) { + gn_args += enable_plugins=true +} else { + gn_args += enable_plugins=false +} + +qtConfig(webengine-spellchecker) { + gn_args += enable_spellcheck=true +} else { + gn_args += enable_spellcheck=false +} + +qtConfig(webengine-webrtc) { + gn_args += enable_webrtc=true +} else { + gn_args += enable_webrtc=false audio_processing_in_audio_service_supported=false +} + +qtConfig(webengine-proprietary-codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\" + +qtConfig(webengine-extensions) { + gn_args += enable_extensions=true +} else { + gn_args += enable_extensions=false +} + +precompile_header { + gn_args += enable_precompiled_headers=true +} else { + gn_args += enable_precompiled_headers=false +} + +CONFIG(release, debug|release):!qtConfig(webengine-developer-build) { + gn_args += is_official_build=true +} else { + gn_args += is_official_build=false + !qtConfig(webengine-developer-build): gn_args += is_unsafe_developer_build=false +} + +CONFIG(release, debug|release) { + gn_args += is_debug=false + force_debug_info { + # Level 1 is not enough to generate all Chromium debug symbols on Windows + msvc: gn_args += symbol_level=2 + else: gn_args += symbol_level=1 + } else { + gn_args += symbol_level=0 + } +} + +CONFIG(debug, debug|release) { + gn_args += is_debug=true + gn_args += use_debug_fission=false + # MSVC requires iterator debug to always match and Qt leaves it default on. + msvc: gn_args += enable_iterator_debugging=true + + # We also can not have optimized V8 binaries for MSVC as iterator debugging + # would mismatch. + msvc|v8base_debug: gn_args += v8_optimized_debug=false +} + +!webcore_debug: gn_args += blink_symbol_level=0 +!v8base_debug: gn_args += remove_v8base_debug_symbols=true + +# Compiling with -Os makes a huge difference in binary size +optimize_size: gn_args += optimize_for_size=true + +# We don't want to apply sanitizer options to the build tools (GN, dict convert, etc). +!host_build { + sanitize_address: gn_args += is_asan=true + sanitize_thread: gn_args += is_tsan=true + sanitize_memory: gn_args += is_msan=true + sanitize_undefined: gn_args += is_ubsan=true is_ubsan_vptr=true +} + +qtConfig(webengine-v8-snapshot):qtConfig(webengine-v8-snapshot-support) { + gn_args += v8_use_snapshot=true +} else { + gn_args += v8_use_snapshot=false +} + +qtConfig(webengine-kerberos) { + gn_args += use_kerberos=true +} else { + gn_args += use_kerberos=false +} + +ccache { + gn_args += cc_wrapper=\"ccache\" +} diff --git a/src/buildtools/config/functions.pri b/src/buildtools/config/functions.pri new file mode 100644 index 000000000..8c11faa16 --- /dev/null +++ b/src/buildtools/config/functions.pri @@ -0,0 +1,8 @@ +defineReplace(qtwebengine_extractCFlag) { + CFLAGS = $$QMAKE_CC $$QMAKE_CFLAGS + OPTION = $$find(CFLAGS, $$1) + OPTION = $$split(OPTION, =) + PARAM = $$member(OPTION, 1) + !isEmpty(PARAM): return ($$PARAM) + return ($$OPTION) +} diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri new file mode 100644 index 000000000..998aedc40 --- /dev/null +++ b/src/buildtools/config/linux.pri @@ -0,0 +1,203 @@ +include(common.pri) +include(functions.pri) + +defineReplace(extractCFlag) { + return($$qtwebengine_extractCFlag($$1)) +} + +QT_FOR_CONFIG += gui-private webenginecore-private + +gn_args += \ + use_cups=false \ + use_gio=false \ + use_gnome_keyring=false \ + linux_use_bundled_binutils=false \ + use_udev=true \ + use_bundled_fontconfig=false \ + use_sysroot=false \ + enable_session_service=false \ + is_cfi=false \ + strip_absolute_paths_from_debug_symbols=false \ + toolkit_views=false \ + use_ozone=true \ + ozone_auto_platforms=false \ + ozone_platform_headless=false \ + ozone_platform_external=true \ + ozone_platform=\"qt\" \ + ozone_extra_path=\"$$QTWEBENGINE_ROOT/src/core/ozone/ozone_extra.gni\" + +qtConfig(webengine-embedded-build) { + gn_args += is_desktop_linux=false +} + +use_gold_linker: gn_args += use_gold=true +else: gn_args += use_gold=false + +use_lld_linker: gn_args += use_lld=true +else: gn_args += use_lld=false + +clang { + clang_full_path = $$which($${QMAKE_CXX}) + # Remove the "/bin/clang++" part. + clang_prefix = $$section(clang_full_path, /, 0, -3) + gn_args += \ + is_clang=true \ + clang_use_chrome_plugins=false \ + clang_use_default_sample_profile=false \ + clang_base_path=\"$${clang_prefix}\" + + linux-clang-libc++: gn_args += use_libcxx=true +} else { + gn_args += \ + is_clang=false +} + +cross_compile:!host_build { + TOOLCHAIN_SYSROOT = $$[QT_SYSROOT] + !isEmpty(TOOLCHAIN_SYSROOT): gn_args += target_sysroot=\"$${TOOLCHAIN_SYSROOT}\" +} + +contains(QT_ARCH, "arm") { + # Extract ARM specific compiler options that we have to pass to gn, + # but let gn figure out a default if an option is not present. + MTUNE = $$extractCFlag("-mtune=.*") + !isEmpty(MTUNE): gn_args += arm_tune=\"$$MTUNE\" + + MFLOAT = $$extractCFlag("-mfloat-abi=.*") + !isEmpty(MFLOAT): gn_args += arm_float_abi=\"$$MFLOAT\" + + MARCH = $$extractCFlag("-march=.*") + !isEmpty(MARCH): gn_args += arm_arch=\"$$MARCH\" + + MARMV = $$replace(MARCH, "armv",) + !isEmpty(MARMV) { + MARMV = $$split(MARMV,) + MARMV = $$member(MARMV, 0) + lessThan(MARMV, 6): error("$$MARCH architecture is not supported") + gn_args += arm_version=$$MARMV + } + + # TODO: use neon detection from qtbase + !lessThan(MARMV, 8) { + gn_args += arm_use_neon=true + } else { + MFPU = $$extractCFlag("-mfpu=.*") + !isEmpty(MFPU):contains(MFPU, ".*neon.*") { + gn_args += arm_use_neon=true + } else { + gn_args += arm_use_neon=false + # If the toolchain does not explicitly specify to use NEON instructions + # we use arm_neon_optional for ARMv7 + equals(MARMV, 7): gn_args += arm_optionally_use_neon=true + } + } + + qtConfig(webengine-arm-thumb) { + gn_args += arm_use_thumb=true # this adds -mthumb + } else { + gn_args += arm_use_thumb=false + !qtConfig(webengine-system-ffmpeg) { + # Fixme QTBUG-71772 + gn_args += media_use_ffmpeg=false + gn_args += use_webaudio_ffmpeg=false + } + } +} + +contains(QT_ARCH, "mips") { + MARCH = $$extractCFlag("-march=.*") + !isEmpty(MARCH) { + equals(MARCH, "mips32r6"): gn_args += mips_arch_variant=\"r6\" + else: equals(MARCH, "mips32r2"): gn_args += mips_arch_variant=\"r2\" + else: equals(MARCH, "mips32"): gn_args += mips_arch_variant=\"r1\" + } else { + contains(QMAKE_CFLAGS, "mips32r6"): gn_args += mips_arch_variant=\"r6\" + else: contains(QMAKE_CFLAGS, "mips32r2"): gn_args += mips_arch_variant=\"r2\" + else: contains(QMAKE_CFLAGS, "mips32"): gn_args += mips_arch_variant=\"r1\" + } + + contains(QMAKE_CFLAGS, "-mmsa"): gn_args += mips_use_msa=true + + contains(QMAKE_CFLAGS, "-mdsp2"): gn_args += mips_dsp_rev=2 + else: contains(QMAKE_CFLAGS, "-mdsp"): gn_args += mips_dsp_rev=1 +} + +host_build { + gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" + GN_HOST_CPU = $$gnArch($$QT_ARCH) + gn_args += host_cpu=\"$$GN_HOST_CPU\" + # Don't bother trying to use system libraries in this case + gn_args += use_glib=false +} else { + gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:target\" + gn_args += host_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" + GN_TARGET_CPU = $$gnArch($$QT_ARCH) + cross_compile { + gn_args += v8_snapshot_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:v8_snapshot\" + # FIXME: we should set host_cpu in case host-toolchain doesn't match os arch, + # but currently we don't it available at this point + gn_args += target_cpu=\"$$GN_TARGET_CPU\" + } else { + gn_args += host_cpu=\"$$GN_TARGET_CPU\" + } + !contains(QT_CONFIG, no-pkg-config) { + # Strip '>2 /dev/null' from $$pkgConfigExecutable() + PKGCONFIG = $$first($$list($$pkgConfigExecutable())) + gn_args += pkg_config=\"$$PKGCONFIG\" + PKG_CONFIG_HOST = $$(GN_PKG_CONFIG_HOST) + pkgConfigLibDir = $$(PKG_CONFIG_LIBDIR) + pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR) + isEmpty(PKG_CONFIG_HOST): cross_compile { + !isEmpty(pkgConfigLibDir)|!isEmpty(pkgConfigSysrootDir) { + PKG_CONFIG_HOST = $$pkgConfigHostExecutable() + } + } + isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = $$QMAKE_PKG_CONFIG_HOST + gn_args += host_pkg_config=\"$$PKG_CONFIG_HOST\" + } + + qtConfig(webengine-system-zlib) { + qtConfig(webengine-system-minizip): gn_args += use_system_zlib=true use_system_minizip=true + qtConfig(webengine-printing-and-pdf): gn_args += pdfium_use_system_zlib=true + } + qtConfig(webengine-system-png) { + gn_args += use_system_libpng=true + qtConfig(webengine-printing-and-pdf): gn_args += pdfium_use_system_libpng=true + } + qtConfig(webengine-system-jpeg): gn_args += use_system_libjpeg=true + qtConfig(webengine-system-freetype): gn_args += use_system_freetype=true + qtConfig(webengine-system-harfbuzz): gn_args += use_system_harfbuzz=true + !qtConfig(webengine-system-glib): gn_args += use_glib=false + qtConfig(webengine-pulseaudio) { + gn_args += use_pulseaudio=true + } else { + gn_args += use_pulseaudio=false + } + qtConfig(webengine-alsa) { + gn_args += use_alsa=true + } else { + gn_args += use_alsa=false + } + !packagesExist(libpci): gn_args += use_libpci=false + + qtConfig(webengine-ozone-x11) { + gn_args += ozone_platform_x11=true + packagesExist(xscrnsaver): gn_args += use_xscrnsaver=true + } + + qtConfig(webengine-system-libevent): gn_args += use_system_libevent=true + qtConfig(webengine-system-libwebp): gn_args += use_system_libwebp=true + qtConfig(webengine-system-libxml2): gn_args += use_system_libxml=true use_system_libxslt=true + qtConfig(webengine-system-opus): gn_args += use_system_opus=true + qtConfig(webengine-system-snappy): gn_args += use_system_snappy=true + qtConfig(webengine-system-libvpx): gn_args += use_system_libvpx=true + qtConfig(webengine-system-icu): gn_args += use_system_icu=true icu_use_data_file=false + qtConfig(webengine-system-ffmpeg): gn_args += use_system_ffmpeg=true + qtConfig(webengine-system-re2): gn_args += use_system_re2=true + qtConfig(webengine-system-lcms2): gn_args += use_system_lcms2=true + + # FIXME: + #qtConfig(webengine-system-protobuf): gn_args += use_system_protobuf=true + #qtConfig(webengine-system-jsoncpp): gn_args += use_system_jsoncpp=true + #qtConfig(webengine-system-libsrtp: gn_args += use_system_libsrtp=true +} diff --git a/src/buildtools/config/mac_osx.pri b/src/buildtools/config/mac_osx.pri new file mode 100644 index 000000000..3f2fe9c0a --- /dev/null +++ b/src/buildtools/config/mac_osx.pri @@ -0,0 +1,39 @@ +include(common.pri) +load(functions) + +# Reuse the cached sdk version value from mac/sdk.prf if available +# otherwise query for it. +QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.SDKVersion) +isEmpty(QMAKE_MAC_SDK_VERSION) { + QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $${QMAKE_MAC_SDK} -version SDKVersion 2>/dev/null") + isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$${QMAKE_MAC_SDK}\'") +} + +QMAKE_CLANG_DIR = "/usr" +QMAKE_CLANG_PATH = $$eval(QMAKE_MAC_SDK.macx-clang.$${QMAKE_MAC_SDK}.QMAKE_CXX) +!isEmpty(QMAKE_CLANG_PATH) { + clang_dir = $$clean_path("$$dirname(QMAKE_CLANG_PATH)/../") + exists($$clang_dir): QMAKE_CLANG_DIR = $$clang_dir +} + +QMAKE_CLANG_PATH = "$${QMAKE_CLANG_DIR}/bin/clang++" +message("Using clang++ from $${QMAKE_CLANG_PATH}") +system("$${QMAKE_CLANG_PATH} --version") + + +gn_args += \ + is_clang=true \ + use_sysroot=false \ + use_system_xcode=true \ + clang_base_path=\"$${QMAKE_CLANG_DIR}\" \ + clang_use_chrome_plugins=false \ + mac_deployment_target=\"$${QMAKE_MACOSX_DEPLOYMENT_TARGET}\" \ + mac_sdk_min=\"$${QMAKE_MAC_SDK_VERSION}\" \ + use_external_popup_menu=false + +qtConfig(webengine-spellchecker) { + qtConfig(webengine-native-spellchecker): gn_args += use_browser_spellchecker=true + else: gn_args += use_browser_spellchecker=false +} else { + gn_args += use_browser_spellchecker=false +} diff --git a/src/buildtools/config/windows.pri b/src/buildtools/config/windows.pri new file mode 100644 index 000000000..dfa40e9dc --- /dev/null +++ b/src/buildtools/config/windows.pri @@ -0,0 +1,89 @@ +include(common.pri) + +gn_args += \ + use_sysroot=false \ + enable_session_service=false \ + ninja_use_custom_environment_files=false \ + is_multi_dll_chrome=false \ + win_linker_timing=true \ + com_init_check_hook_disabled=true + +clang_cl { + clang_full_path = $$system_path($$which($${QMAKE_CXX})) + # Remove the "\bin\clang-cl.exe" part: + clang_dir = $$dirname(clang_full_path) + clang_prefix = $$join(clang_dir,,,"\..") + gn_args += \ + is_clang=true \ + use_ldd=true \ + clang_use_chrome_plugins=false \ + clang_base_path=\"$$system_path($$clean_path($$clang_prefix))\" +} else { + gn_args += is_clang=false use_lld=false +} + +qtConfig(webengine-developer-build) { + gn_args += \ + is_win_fastlink=true + + # Incremental linking doesn't work in release developer builds due to usage of /OPT:ICF + # by Chromium. + CONFIG(debug, debug|release) { + gn_args += \ + use_incremental_linking=true + } else { + gn_args += \ + use_incremental_linking=false + } +} else { + gn_args += \ + is_win_fastlink=false \ + use_incremental_linking=false +} + +defineTest(usingMSVC32BitCrossCompiler) { + CL_DIR = + for(dir, QMAKE_PATH_ENV) { + exists($$dir/cl.exe) { + CL_DIR = $$dir + break() + } + } + isEmpty(CL_DIR): { + warning(Cannot determine location of cl.exe.) + return(false) + } + CL_DIR = $$system_path($$CL_DIR) + CL_DIR = $$split(CL_DIR, \\) + CL_PLATFORM = $$last(CL_DIR) + equals(CL_PLATFORM, amd64_x86): return(true) + return(false) +} + +msvc:contains(QT_ARCH, "i386"):!usingMSVC32BitCrossCompiler() { + # The 32 bit MSVC linker runs out of memory if we do not remove all debug information. + force_debug_info: gn_args -= symbol_level=1 + gn_args *= symbol_level=0 +} + +msvc { + equals(MSVC_VER, 15.0) { + MSVS_VERSION = 2017 + } else: equals(MSVC_VER, 16.0) { + MSVS_VERSION = 2019 + } else { + error("Visual Studio compiler version \"$$MSVC_VER\" is not supported by Qt WebEngine") + } + + gn_args += visual_studio_version=$$MSVS_VERSION + + SDK_PATH = $$(WINDOWSSDKDIR) + VS_PATH= $$(VSINSTALLDIR) + gn_args += visual_studio_path=\"$$clean_path($$VS_PATH)\" + gn_args += windows_sdk_path=\"$$clean_path($$SDK_PATH)\" + + GN_TARGET_CPU = $$gnArch($$QT_ARCH) + gn_args += target_cpu=\"$$GN_TARGET_CPU\" +} else { + error("Qt WebEngine for Windows can only be built with a Microsoft Visual Studio C++ compatible compiler") +} |