# 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/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")
if (!is_starboard) {
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 (current_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 (current_cpu == "x86") {
      cflags += [ "-m32" ]
    } else if (current_cpu == "x64") {
      cflags += [ "-m64" ]
    } else if (current_cpu == "arm64") {
      cflags += [ "--target=arm64-windows" ]
    } else {
      assert(false, "unknown current_cpu " + current_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 (current_cpu == "x86" || current_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" ]
    }
  }

  if (use_lld && !use_thin_lto && (is_clang || !use_goma)) {
    # /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=NTDDI_WIN10_VB",

    # 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(current_cpu == "x64" || current_cpu == "x86" || current_cpu == "arm" ||
             current_cpu == "arm64",
         "Only supports x64, x86, arm and arm64 CPUs")
  if (current_cpu == "x64") {
    ldflags = [ "/MACHINE:X64" ]
  } else if (current_cpu == "x86") {
    ldflags = [
      "/MACHINE:X86",
      "/SAFESEH",  # Not compatible with x64 so use only for x86.
      "/largeaddressaware",
    ]
  } else if (current_cpu == "arm") {
    ldflags = [ "/MACHINE:ARM" ]
  } else if (current_cpu == "arm64") {
    ldflags = [ "/MACHINE:ARM64" ]
  }

  if (!is_starboard) {
  vcvars_toolchain_data = exec_script("../../toolchain/win/setup_toolchain.py",
                                      [
                                        visual_studio_path,
                                        windows_sdk_path,
                                        visual_studio_runtime_dirs,
                                        current_os,
                                        current_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" ]
  } else {
    cflags = [ "/MT" ]
  }
}

config("dynamic_crt") {
  if (is_debug) {
    # This pulls in the DLL debug CRT and defines _DEBUG
    cflags = [ "/MDd" ]
  } else {
    cflags = [ "/MD" ]
  }
}

config("static_crt") {
  if (is_debug) {
    # This pulls in the static debug CRT and defines _DEBUG
    cflags = [ "/MTd" ]
  } else {
    cflags = [ "/MT" ]
  }
}

# Subsystem --------------------------------------------------------------------

# This is appended to the subsystem to specify a minimum version.
if (current_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 (current_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" ]
}
