summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/config/win
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/build/config/win')
-rw-r--r--third_party/libwebrtc/build/config/win/BUILD.gn610
-rw-r--r--third_party/libwebrtc/build/config/win/console_app.gni18
-rw-r--r--third_party/libwebrtc/build/config/win/control_flow_guard.gni23
-rw-r--r--third_party/libwebrtc/build/config/win/manifest.gni118
-rw-r--r--third_party/libwebrtc/build/config/win/visual_studio_version.gni39
5 files changed, 808 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/config/win/BUILD.gn b/third_party/libwebrtc/build/config/win/BUILD.gn
new file mode 100644
index 0000000000..afeea308df
--- /dev/null
+++ b/third_party/libwebrtc/build/config/win/BUILD.gn
@@ -0,0 +1,610 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/c++/c++.gni")
+import("//build/config/chrome_build.gni")
+import("//build/config/clang/clang.gni")
+import("//build/config/compiler/compiler.gni")
+import("//build/config/sanitizers/sanitizers.gni")
+import("//build/config/win/control_flow_guard.gni")
+import("//build/config/win/visual_studio_version.gni")
+import("//build/timestamp.gni")
+import("//build/toolchain/goma.gni")
+import("//build/toolchain/toolchain.gni")
+
+assert(is_win)
+
+declare_args() {
+ # Turn this on to have the linker output extra timing information.
+ win_linker_timing = false
+
+ # possible values for target_winuwp_version:
+ # "10" - Windows UWP 10
+ # "8.1" - Windows RT 8.1
+ # "8.0" - Windows RT 8.0
+ target_winuwp_version = "10"
+
+ # possible values:
+ # "app" - Windows Store Applications
+ # "phone" - Windows Phone Applications
+ # "system" - Windows Drivers and Tools
+ # "server" - Windows Server Applications
+ # "desktop" - Windows Desktop Applications
+ target_winuwp_family = "app"
+
+ # Set this to use clang-style diagnostics format instead of MSVC-style, which
+ # is useful in e.g. Emacs compilation mode.
+ # E.g.:
+ # Without this, clang emits a diagnostic message like this:
+ # foo/bar.cc(12,34): error: something went wrong
+ # and with this switch, clang emits it like this:
+ # foo/bar.cc:12:34: error: something went wrong
+ use_clang_diagnostics_format = false
+}
+
+# This is included by reference in the //build/config/compiler config that
+# is applied to all targets. It is here to separate out the logic that is
+# Windows-only.
+config("compiler") {
+ if (target_cpu == "x86") {
+ asmflags = [
+ # When /safeseh is specified, the linker will only produce an image if it
+ # can also produce a table of the image's safe exception handlers. This
+ # table specifies for the operating system which exception handlers are
+ # valid for the image. Note that /SAFESEH isn't accepted on the command
+ # line, only /safeseh. This is only accepted by ml.exe, not ml64.exe.
+ "/safeseh",
+ ]
+ }
+
+ cflags = [
+ "/Gy", # Enable function-level linking.
+ "/FS", # Preserve previous PDB behavior.
+ "/bigobj", # Some of our files are bigger than the regular limits.
+ "/utf-8", # Assume UTF-8 by default to avoid code page dependencies.
+ ]
+
+ if (is_clang) {
+ cflags += [ "/Zc:twoPhase" ]
+ }
+
+ # Force C/C++ mode for the given GN detected file type. This is necessary
+ # for precompiled headers where the same source file is compiled in both
+ # modes.
+ cflags_c = [ "/TC" ]
+ cflags_cc = [ "/TP" ]
+
+ cflags += [
+ # Work around crbug.com/526851, bug in VS 2015 RTM compiler.
+ "/Zc:sizedDealloc-",
+ ]
+
+ if (is_clang) {
+ # Required to make the 19041 SDK compatible with clang-cl.
+ # See https://crbug.com/1089996 issue #2 for details.
+ cflags += [ "/D__WRL_ENABLE_FUNCTION_STATICS__" ]
+
+ # Tell clang which version of MSVC to emulate.
+ cflags += [ "-fmsc-version=1916" ]
+
+ if (is_component_build) {
+ cflags += [
+ # Do not export inline member functions. This makes component builds
+ # faster. This is similar to -fvisibility-inlines-hidden.
+ "/Zc:dllexportInlines-",
+ ]
+ }
+
+ if (target_cpu == "x86") {
+ cflags += [ "-m32" ]
+ } else if (target_cpu == "x64") {
+ cflags += [ "-m64" ]
+ } else if (target_cpu == "arm64") {
+ cflags += [ "--target=arm64-windows" ]
+ } else {
+ assert(false, "unknown target_cpu " + target_cpu)
+ }
+
+ # Chrome currently requires SSE3. Clang supports targeting any Intel
+ # microarchitecture. MSVC only supports a subset of architectures, and the
+ # next step after SSE2 will be AVX.
+ if (target_cpu == "x86" || target_cpu == "x64") {
+ cflags += [ "-msse3" ]
+ }
+
+ if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
+ "True") {
+ cflags += [
+ # cmd.exe doesn't understand ANSI escape codes by default,
+ # so only enable them if something emulating them is around.
+ "-fansi-escape-codes",
+ ]
+ }
+
+ if (use_clang_diagnostics_format) {
+ cflags += [ "/clang:-fdiagnostics-format=clang" ]
+ }
+ }
+
+ # Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
+ if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
+ # /Brepro lets the compiler not write the mtime field in the .obj output.
+ # link.exe /incremental relies on this field to work correctly, but lld
+ # never looks at this timestamp, so it's safe to pass this flag with
+ # lld and get more deterministic compiler output in return.
+ # In LTO builds, the compiler doesn't write .obj files containing mtimes,
+ # so /Brepro is ignored there.
+ cflags += [ "/Brepro" ]
+ }
+
+ ldflags = []
+
+ if (use_lld) {
+ # lld defaults to writing the current time in the pe/coff header.
+ # For build reproducibility, pass an explicit timestamp. See
+ # build/compute_build_timestamp.py for how the timestamp is chosen.
+ # (link.exe also writes the current time, but it doesn't have a flag to
+ # override that behavior.)
+ ldflags += [ "/TIMESTAMP:" + build_timestamp ]
+
+ # Don't look for libpaths in %LIB%, similar to /X in cflags above.
+ ldflags += [ "/lldignoreenv" ]
+ }
+
+ if (!is_debug && !is_component_build) {
+ # Enable standard linker optimizations like GC (/OPT:REF) and ICF in static
+ # release builds.
+ # Release builds always want these optimizations, so enable them explicitly.
+ ldflags += [
+ "/OPT:REF",
+ "/OPT:ICF",
+ "/INCREMENTAL:NO",
+ "/FIXED:NO",
+ ]
+
+ if (use_lld) {
+ # String tail merging leads to smaller binaries, but they don't compress
+ # as well, leading to increased mini_installer size (crbug.com/838449).
+ ldflags += [ "/OPT:NOLLDTAILMERGE" ]
+ }
+
+ # TODO(siggi): Is this of any use anymore?
+ # /PROFILE ensures that the PDB file contains FIXUP information (growing the
+ # PDB file by about 5%) but does not otherwise alter the output binary. It
+ # is enabled opportunistically for builds where it is not prohibited (not
+ # supported when incrementally linking, or using /debug:fastlink).
+ ldflags += [ "/PROFILE" ]
+ }
+
+ # arflags apply only to static_libraries. The normal linker configs are only
+ # set for executable and shared library targets so arflags must be set
+ # elsewhere. Since this is relatively contained, we just apply them in this
+ # more general config and they will only have an effect on static libraries.
+ arflags = [
+ # "No public symbols found; archive member will be inaccessible." This
+ # means that one or more object files in the library can never be
+ # pulled in to targets that link to this library. It's just a warning that
+ # the source file is a no-op.
+ "/ignore:4221",
+ ]
+}
+
+# This is included by reference in the //build/config/compiler:runtime_library
+# config that is applied to all targets. It is here to separate out the logic
+# that is Windows-only. Please see that target for advice on what should go in
+# :runtime_library vs. :compiler.
+config("runtime_library") {
+ cflags = []
+ cflags_cc = []
+
+ # Defines that set up the CRT.
+ defines = [
+ "__STD_C",
+ "_CRT_RAND_S",
+ "_CRT_SECURE_NO_DEPRECATE",
+ "_SCL_SECURE_NO_DEPRECATE",
+ ]
+
+ # Defines that set up the Windows SDK.
+ defines += [
+ "_ATL_NO_OPENGL",
+ "_WINDOWS",
+ "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
+ "PSAPI_VERSION=2",
+ "WIN32",
+ "_SECURE_ATL",
+ ]
+
+ if (current_os == "winuwp") {
+ # When targeting Windows Runtime, certain compiler/linker flags are
+ # necessary.
+ defines += [
+ "WINUWP",
+ "__WRL_NO_DEFAULT_LIB__",
+ ]
+ if (target_winuwp_family == "app") {
+ defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ]
+ } else if (target_winuwp_family == "phone") {
+ defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP" ]
+ } else if (target_winuwp_family == "system") {
+ defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_SYSTEM" ]
+ } else if (target_winuwp_family == "server") {
+ defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_SERVER" ]
+ } else {
+ defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" ]
+ }
+ cflags_cc += [ "/EHsc" ]
+
+ # This warning is given because the linker cannot tell the difference
+ # between consuming WinRT APIs versus authoring WinRT within static
+ # libraries as such this warning is always given by the linker. Since
+ # consuming WinRT APIs within a library is legitimate but authoring
+ # WinRT APis is not allowed, this warning is disabled to ignore the
+ # legitimate consumption of WinRT APIs within static library builds.
+ arflags = [ "/IGNORE:4264" ]
+
+ if (target_winuwp_version == "10") {
+ defines += [ "WIN10=_WIN32_WINNT_WIN10" ]
+ } else if (target_winuwp_version == "8.1") {
+ defines += [ "WIN8_1=_WIN32_WINNT_WINBLUE" ]
+ } else if (target_winuwp_version == "8.0") {
+ defines += [ "WIN8=_WIN32_WINNT_WIN8" ]
+ }
+ } else {
+ # When not targeting Windows Runtime, make sure the WINAPI family is set
+ # to desktop.
+ defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" ]
+ }
+}
+
+# Chromium supports running on Windows 7, but if these constants are set to
+# Windows 7, then newer APIs aren't made available by the Windows SDK.
+# So we set this to Windows 10 and then are careful to check at runtime
+# to only call newer APIs when they're available.
+# Some third-party libraries assume that these defines set what version of
+# Windows is available at runtime. Targets using these libraries need to
+# manually override this config for their compiles.
+config("winver") {
+ defines = [
+ "NTDDI_VERSION=0x0A000000",
+
+ # We can't say `=_WIN32_WINNT_WIN10` here because some files do
+ # `#if WINVER < 0x0600` without including windows.h before,
+ # and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
+ "_WIN32_WINNT=0x0A00",
+ "WINVER=0x0A00",
+ ]
+}
+
+# Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
+config("sdk_link") {
+ assert(target_cpu == "x64" || target_cpu == "x86" || target_cpu == "arm" ||
+ target_cpu == "arm64",
+ "Only supports x64, x86, arm and arm64 CPUs")
+ if (target_cpu == "x64") {
+ ldflags = [ "/MACHINE:X64" ]
+ } else if (target_cpu == "x86") {
+ ldflags = [
+ "/MACHINE:X86",
+ "/SAFESEH", # Not compatible with x64 so use only for x86.
+ "/largeaddressaware",
+ ]
+ } else if (target_cpu == "arm") {
+ ldflags = [ "/MACHINE:ARM" ]
+ } else if (target_cpu == "arm64") {
+ ldflags = [ "/MACHINE:ARM64" ]
+ }
+
+ vcvars_toolchain_data = exec_script("../../toolchain/win/setup_toolchain.py",
+ [
+ visual_studio_path,
+ windows_sdk_path,
+ visual_studio_runtime_dirs,
+ current_os,
+ target_cpu,
+ "none",
+ ],
+ "scope")
+
+ vc_lib_path = vcvars_toolchain_data.vc_lib_path
+ if (defined(vcvars_toolchain_data.vc_lib_atlmfc_path)) {
+ vc_lib_atlmfc_path = vcvars_toolchain_data.vc_lib_atlmfc_path
+ }
+ vc_lib_um_path = vcvars_toolchain_data.vc_lib_um_path
+
+ lib_dirs = [
+ "$vc_lib_um_path",
+ "$vc_lib_path",
+ ]
+ if (defined(vc_lib_atlmfc_path)) {
+ lib_dirs += [ "$vc_lib_atlmfc_path" ]
+ }
+}
+
+# This default linker setup is provided separately from the SDK setup so
+# targets who want different library configurations can remove this and specify
+# their own.
+config("common_linker_setup") {
+ ldflags = [
+ "/FIXED:NO",
+ "/ignore:4199",
+ "/ignore:4221",
+ "/NXCOMPAT",
+ "/DYNAMICBASE",
+ ]
+
+ if (win_linker_timing) {
+ ldflags += [
+ "/time",
+ "/verbose:incr",
+ ]
+ }
+}
+
+config("default_cfg_compiler") {
+ # Emit table of address-taken functions for Control-Flow Guard (CFG).
+ # This is needed to allow functions to be called by code that is built
+ # with CFG enabled, such as system libraries.
+ # The CFG guards are only emitted if |win_enable_cfg_guards| is enabled.
+ if (is_clang) {
+ if (win_enable_cfg_guards) {
+ cflags = [ "/guard:cf" ]
+ } else {
+ cflags = [ "/guard:cf,nochecks" ]
+ }
+ }
+}
+
+# To disable CFG guards for a target, remove the "default_cfg_compiler"
+# config, and add "disable_guards_cfg_compiler" config.
+config("disable_guards_cfg_compiler") {
+ # Emit table of address-taken functions for Control-Flow Guard (CFG).
+ # This is needed to allow functions to be called by code that is built
+ # with CFG enabled, such as system libraries.
+ if (is_clang) {
+ cflags = [ "/guard:cf,nochecks" ]
+ }
+}
+
+config("cfi_linker") {
+ # Control Flow Guard (CFG)
+ # https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx
+ # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG cannot be
+ # turned on either.
+ # ASan and CFG leads to slow process startup. Chromium's test runner uses
+ # lots of child processes, so this means things are really slow. Disable CFG
+ # for now. https://crbug.com/846966
+ if (!is_debug && !is_asan) {
+ # Turn on CFG bitmap generation and CFG load config.
+ ldflags = [ "/guard:cf" ]
+ }
+}
+
+# This is a superset of all the delayloads needed for chrome.exe, chrome.dll,
+# chrome_child.dll, and chrome_elf.dll. The linker will automatically ignore
+# anything which is not linked to the binary at all.
+# Most of the dlls are simply not required at startup (or at all, depending
+# on how the browser is used). The following dlls are interconnected and need to
+# be delayloaded together to ensure user32 does not load too early or at all,
+# depending on the process type: user32, gdi32, comctl32, comdlg32, cryptui,
+# d3d9, dwmapi, imm32, msi, ole32, oleacc, rstrtmgr, shell32, shlwapi, and
+# uxtheme.
+# There are some exceptions to this list which need to be declared separately.
+# Some dlls cannot be delayloaded by chrome_child.dll due to the sandbox
+# restrictions that prevent them from being loaded properly. Those dlls are
+# specified in the separate config below.
+# This config should also be used for any test binary whose goal is to run
+# tests with the full browser.
+config("delayloads") {
+ ldflags = [
+ "/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
+ "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
+ "/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
+ "/DELAYLOAD:comctl32.dll",
+ "/DELAYLOAD:comdlg32.dll",
+ "/DELAYLOAD:credui.dll",
+ "/DELAYLOAD:cryptui.dll",
+ "/DELAYLOAD:d3d11.dll",
+ "/DELAYLOAD:d3d9.dll",
+ "/DELAYLOAD:dwmapi.dll",
+ "/DELAYLOAD:dxgi.dll",
+ "/DELAYLOAD:dxva2.dll",
+ "/DELAYLOAD:esent.dll",
+ "/DELAYLOAD:gdi32.dll",
+ "/DELAYLOAD:hid.dll",
+ "/DELAYLOAD:imagehlp.dll",
+ "/DELAYLOAD:imm32.dll",
+ "/DELAYLOAD:msi.dll",
+ "/DELAYLOAD:netapi32.dll",
+ "/DELAYLOAD:ncrypt.dll",
+ "/DELAYLOAD:ole32.dll",
+ "/DELAYLOAD:oleacc.dll",
+ "/DELAYLOAD:propsys.dll",
+ "/DELAYLOAD:psapi.dll",
+ "/DELAYLOAD:rpcrt4.dll",
+ "/DELAYLOAD:rstrtmgr.dll",
+ "/DELAYLOAD:setupapi.dll",
+ "/DELAYLOAD:shell32.dll",
+ "/DELAYLOAD:shlwapi.dll",
+ "/DELAYLOAD:urlmon.dll",
+ "/DELAYLOAD:user32.dll",
+ "/DELAYLOAD:usp10.dll",
+ "/DELAYLOAD:uxtheme.dll",
+ "/DELAYLOAD:wer.dll",
+ "/DELAYLOAD:wevtapi.dll",
+ "/DELAYLOAD:wininet.dll",
+ "/DELAYLOAD:winusb.dll",
+ "/DELAYLOAD:wsock32.dll",
+ "/DELAYLOAD:wtsapi32.dll",
+ ]
+}
+
+config("delayloads_not_for_child_dll") {
+ ldflags = [
+ "/DELAYLOAD:advapi32.dll",
+ "/DELAYLOAD:crypt32.dll",
+ "/DELAYLOAD:dbghelp.dll",
+ "/DELAYLOAD:dhcpcsvc.dll",
+ "/DELAYLOAD:dwrite.dll",
+ "/DELAYLOAD:iphlpapi.dll",
+ "/DELAYLOAD:oleaut32.dll",
+ "/DELAYLOAD:secur32.dll",
+ "/DELAYLOAD:uiautomationcore.dll",
+ "/DELAYLOAD:userenv.dll",
+ "/DELAYLOAD:winhttp.dll",
+ "/DELAYLOAD:winmm.dll",
+ "/DELAYLOAD:winspool.drv",
+ "/DELAYLOAD:wintrust.dll",
+ "/DELAYLOAD:ws2_32.dll",
+ ]
+}
+
+# CRT --------------------------------------------------------------------------
+
+# Configures how the runtime library (CRT) is going to be used.
+# See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of
+# what each value does.
+config("default_crt") {
+ if (is_component_build) {
+ # Component mode: dynamic CRT. Since the library is shared, it requires
+ # exceptions or will give errors about things not matching, so keep
+ # exceptions on.
+ configs = [ ":dynamic_crt" ]
+ } else {
+ if (current_os == "winuwp") {
+ # https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great-c-runtime-crt-refactoring/
+ # contains a details explanation of what is happening with the Windows
+ # CRT in Visual Studio releases related to Windows store applications.
+ configs = [ ":dynamic_crt" ]
+ } else {
+ # Desktop Windows: static CRT.
+ configs = [ ":static_crt" ]
+ }
+ }
+}
+
+# Use this to force use of the release CRT when building perf-critical build
+# tools that need to be fully optimized even in debug builds, for those times
+# when the debug CRT is part of the bottleneck. This also avoids *implicitly*
+# defining _DEBUG.
+config("release_crt") {
+ if (is_component_build) {
+ cflags = [ "/MD" ]
+
+ if (use_custom_libcxx) {
+ # On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
+ # standard library, which libc++ needs for exception_ptr internals.
+ ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
+ }
+ } else {
+ cflags = [ "/MT" ]
+ if (use_custom_libcxx) {
+ ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
+ }
+ }
+}
+
+config("dynamic_crt") {
+ if (is_debug) {
+ # This pulls in the DLL debug CRT and defines _DEBUG
+ cflags = [ "/MDd" ]
+ if (use_custom_libcxx) {
+ ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
+ }
+ } else {
+ cflags = [ "/MD" ]
+ if (use_custom_libcxx) {
+ ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
+ }
+ }
+}
+
+config("static_crt") {
+ if (is_debug) {
+ # This pulls in the static debug CRT and defines _DEBUG
+ cflags = [ "/MTd" ]
+ if (use_custom_libcxx) {
+ ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
+ }
+ } else {
+ cflags = [ "/MT" ]
+ if (use_custom_libcxx) {
+ ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
+ }
+ }
+}
+
+# Subsystem --------------------------------------------------------------------
+
+# This is appended to the subsystem to specify a minimum version.
+if (target_cpu == "x64") {
+ # The number after the comma is the minimum required OS version.
+ # 5.02 = Windows Server 2003.
+ subsystem_version_suffix = ",5.02"
+} else if (target_cpu == "arm64") {
+ # Windows ARM64 requires Windows 10.
+ subsystem_version_suffix = ",10.0"
+} else {
+ # 5.01 = Windows XP.
+ subsystem_version_suffix = ",5.01"
+}
+
+config("console") {
+ ldflags = [ "/SUBSYSTEM:CONSOLE$subsystem_version_suffix" ]
+}
+config("windowed") {
+ ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ]
+}
+
+# Incremental linking ----------------------------------------------------------
+
+# Applies incremental linking or not depending on the current configuration.
+config("default_incremental_linking") {
+ # Enable incremental linking for debug builds and all component builds - any
+ # builds where performance is not job one.
+ # TODO(thakis): Always turn this on with lld, no reason not to.
+ if (is_debug || is_component_build) {
+ ldflags = [ "/INCREMENTAL" ]
+ if (use_lld) {
+ # lld doesn't use ilk files and doesn't really have an incremental link
+ # mode; the only effect of the flag is that the .lib file timestamp isn't
+ # updated if the .lib doesn't change.
+ # TODO(thakis): Why pass /OPT:NOREF for lld, but not otherwise?
+ # TODO(thakis): /INCREMENTAL is on by default in link.exe, but not in
+ # lld.
+ ldflags += [ "/OPT:NOREF" ]
+ }
+ } else {
+ ldflags = [ "/INCREMENTAL:NO" ]
+ }
+}
+
+# Character set ----------------------------------------------------------------
+
+# Not including this config means "ansi" (8-bit system codepage).
+config("unicode") {
+ defines = [
+ "_UNICODE",
+ "UNICODE",
+ ]
+}
+
+# Lean and mean ----------------------------------------------------------------
+
+# Some third party code might not compile with WIN32_LEAN_AND_MEAN so we have
+# to have a separate config for it. Remove this config from your target to
+# get the "bloaty and accommodating" version of windows.h.
+config("lean_and_mean") {
+ defines = [ "WIN32_LEAN_AND_MEAN" ]
+}
+
+# Nominmax --------------------------------------------------------------------
+
+# Some third party code defines NOMINMAX before including windows.h, which
+# then causes warnings when it's been previously defined on the command line.
+# For such targets, this config can be removed.
+
+config("nominmax") {
+ defines = [ "NOMINMAX" ]
+}
diff --git a/third_party/libwebrtc/build/config/win/console_app.gni b/third_party/libwebrtc/build/config/win/console_app.gni
new file mode 100644
index 0000000000..cac2ef5d73
--- /dev/null
+++ b/third_party/libwebrtc/build/config/win/console_app.gni
@@ -0,0 +1,18 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/sanitizers/sanitizers.gni")
+
+declare_args() {
+ # If true, builds as a console app (rather than a windowed app), which allows
+ # logging to be printed to the user. This will cause a terminal window to pop
+ # up when the executable is not run from the command line, so should only be
+ # used for development. Only has an effect on Windows builds.
+ win_console_app = false
+}
+
+if (is_win && is_asan) {
+ # AddressSanitizer build should be a console app since it writes to stderr.
+ win_console_app = true
+}
diff --git a/third_party/libwebrtc/build/config/win/control_flow_guard.gni b/third_party/libwebrtc/build/config/win/control_flow_guard.gni
new file mode 100644
index 0000000000..bf6a82af0c
--- /dev/null
+++ b/third_party/libwebrtc/build/config/win/control_flow_guard.gni
@@ -0,0 +1,23 @@
+# Copyright 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/sanitizers/sanitizers.gni")
+
+declare_args() {
+ # Set this to true to enable generation of CFG indirect call dispatch
+ # guards.
+ win_enable_cfg_guards = false
+}
+
+if (win_enable_cfg_guards) {
+ # Control Flow Guard (CFG)
+ # https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx
+ # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG can't be
+ # turned on either.
+ # ASan and CFG leads to slow process startup. Chromium's test runner uses
+ # lots of child processes, so this means things are really slow. Disable CFG
+ # for now. https://crbug.com/846966
+ assert(!is_debug && !is_asan,
+ "CFG does not work well in debug builds or with ASAN")
+}
diff --git a/third_party/libwebrtc/build/config/win/manifest.gni b/third_party/libwebrtc/build/config/win/manifest.gni
new file mode 100644
index 0000000000..e2115083fe
--- /dev/null
+++ b/third_party/libwebrtc/build/config/win/manifest.gni
@@ -0,0 +1,118 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# HOW MANIFESTS WORK IN THE GN BUILD
+#
+# Use the windows_manifest template to declare a manifest generation step.
+# This will combine all listed .manifest files. To link this manifest, just
+# depend on the manifest target from your executable or shared library.
+#
+# This will define an empty placeholder target on non-Windows platforms so
+# the manifest declarations and dependencies do not need to be inside of OS
+# conditionals.
+#
+# A binary can depend on only one manifest target, but the manifest target
+# can depend on many individual .manifest files which will be merged. As a
+# result, only executables and shared libraries should depend on manifest
+# targets. If you want to add a manifest to a component, put the dependency
+# behind a "if (is_component_build)" conditional.
+#
+# Generally you will just want the defaults for the Chrome build. In this case
+# the binary should just depend on one of the targets in //build/win/. There
+# are also individual manifest files in that directory you can reference via
+# the *_manifest variables defined below to pick and choose only some defaults.
+# You might combine these with a custom manifest file to get specific behavior.
+
+# Reference this manifest as a source from windows_manifest targets to get
+# the default Chrome OS compatibility list.
+default_compatibility_manifest = "//build/win/compatibility.manifest"
+
+# Reference this manifest as a source from windows_manifest targets to get
+# the default Chrome common constrols compatibility.
+common_controls_manifest = "//build/win/common_controls.manifest"
+
+# Reference this manifest to request that Windows not perform any elevation
+# when running your program. Otherwise, it might do some autodetection and
+# request elevated privileges from the user. This is normally what you want.
+as_invoker_manifest = "//build/win/as_invoker.manifest"
+
+# An alternative to as_invoker_manifest when you want the application to always
+# elevate.
+require_administrator_manifest = "//build/win/require_administrator.manifest"
+
+# Request the segment heap. See https://crbug.com/1014701 for details.
+declare_args() {
+ enable_segment_heap = false
+}
+segment_heap_manifest = "//build/win/segment_heap.manifest"
+
+# Construct a target to combine the given manifest files into a .rc file.
+#
+# Variables for the windows_manifest template:
+#
+# sources: (required)
+# List of source .manifest files to add.
+#
+# deps: (optional)
+# visibility: (optional)
+# Normal meaning.
+#
+# Example:
+#
+# windows_manifest("doom_melon_manifest") {
+# sources = [
+# "doom_melon.manifest", # Custom values in here.
+# default_compatibility_manifest, # Want the normal OS compat list.
+# ]
+# }
+#
+# executable("doom_melon") {
+# deps = [ ":doom_melon_manifest" ]
+# ...
+# }
+
+if (is_win) {
+ template("windows_manifest") {
+ config_name = "${target_name}__config"
+ source_set_name = target_name
+
+ config(config_name) {
+ visibility = [ ":$source_set_name" ]
+ assert(defined(invoker.sources),
+ "\"sources\" must be defined for a windows_manifest target")
+ manifests = []
+ foreach(i, rebase_path(invoker.sources, root_build_dir)) {
+ manifests += [ "/manifestinput:" + i ]
+ }
+ ldflags = [
+ "/manifest:embed",
+
+ # We handle UAC by adding explicit .manifest files instead.
+ "/manifestuac:no",
+ ] + manifests
+ }
+
+ # This source set only exists to add a dep on the invoker's deps and to
+ # add a public_config that sets ldflags on dependents.
+ source_set(source_set_name) {
+ forward_variables_from(invoker, [ "visibility" ])
+ public_configs = [ ":$config_name" ]
+
+ # Apply any dependencies from the invoker to this target, since those
+ # dependencies may have created the input manifest files.
+ forward_variables_from(invoker, [ "deps" ])
+ }
+ }
+} else {
+ # Make a no-op group on non-Windows platforms so windows_manifest
+ # instantiations don't need to be inside windows blocks.
+ template("windows_manifest") {
+ group(target_name) {
+ # Prevent unused variable warnings on non-Windows platforms.
+ assert(invoker.sources != "")
+ assert(!defined(invoker.deps) || invoker.deps != "")
+ assert(!defined(invoker.visibility) || invoker.visibility != "")
+ }
+ }
+}
diff --git a/third_party/libwebrtc/build/config/win/visual_studio_version.gni b/third_party/libwebrtc/build/config/win/visual_studio_version.gni
new file mode 100644
index 0000000000..80eb0355c4
--- /dev/null
+++ b/third_party/libwebrtc/build/config/win/visual_studio_version.gni
@@ -0,0 +1,39 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+declare_args() {
+ # Path to Visual Studio. If empty, the default is used which is to use the
+ # automatic toolchain in depot_tools. If set, you must also set the
+ # visual_studio_version and wdk_path.
+ visual_studio_path = ""
+
+ # Version of Visual Studio pointed to by the visual_studio_path.
+ # Currently always "2015".
+ visual_studio_version = ""
+
+ # Directory of the Windows driver kit. If visual_studio_path is empty, this
+ # will be auto-filled.
+ wdk_path = ""
+
+ # Full path to the Windows SDK, not including a backslash at the end.
+ # This value is the default location, override if you have a different
+ # installation location.
+ windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10"
+}
+
+if (visual_studio_path == "") {
+ toolchain_data =
+ exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
+ visual_studio_path = toolchain_data.vs_path
+ windows_sdk_path = toolchain_data.sdk_path
+ visual_studio_version = toolchain_data.vs_version
+ wdk_path = toolchain_data.wdk_dir
+ visual_studio_runtime_dirs = toolchain_data.runtime_dirs
+} else {
+ assert(visual_studio_version != "",
+ "You must set the visual_studio_version if you set the path")
+ assert(wdk_path != "",
+ "You must set the wdk_path if you set the visual studio path")
+ visual_studio_runtime_dirs = ""
+}