chromium/build/win/BUILD.gn

# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/clang/clang.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/manifest.gni")

# Depending on this target will cause the manifests for Chrome's default
# Windows and common control compatibility and elevation for executables.
windows_manifest("default_exe_manifest") {
  sources = [
    as_invoker_manifest,
    common_controls_manifest,
    default_compatibility_manifest,
  ]
}

if (is_win) {
  assert(host_os != "mac" || target_cpu != "x86",
         "Windows cross-builds from Mac must be 64-bit.")

  action("copy_cdb_to_output") {
    script = "//build/win/copy_cdb_to_output.py"
    inputs = [
      script,
      "//build/vs_toolchain.py",
    ]
    outputs = [
      "$root_out_dir/cdb/cdb.exe",
      "$root_out_dir/cdb/dbgeng.dll",
      "$root_out_dir/cdb/dbghelp.dll",
      "$root_out_dir/cdb/dbgmodel.dll",
      "$root_out_dir/cdb/winext/ext.dll",
      "$root_out_dir/cdb/winext/uext.dll",
      "$root_out_dir/cdb/winxp/exts.dll",
      "$root_out_dir/cdb/winxp/ntsdexts.dll",
    ]
    args = [
      rebase_path("$root_out_dir/cdb", root_out_dir),
      current_cpu,
    ]
  }

  group("runtime_libs") {
    # These are needed for any tests that need to decode stacks.
    data = [
      "$root_out_dir/dbghelp.dll",
      "$root_out_dir/dbgcore.dll",
    ]
    if (is_component_build) {
      # Copy the VS runtime DLLs into the isolate so that they don't have to be
      # preinstalled on the target machine. The debug runtimes have a "d" at
      # the end.
      if (is_debug) {
        vcrt_suffix = "d"
      } else {
        vcrt_suffix = ""
      }

      # These runtime files are copied to the output directory by the
      # vs_toolchain script that runs as part of toolchain configuration.
      data += [
        "$root_out_dir/msvcp140${vcrt_suffix}.dll",
        "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
        "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
      ]
      if (current_cpu == "x64") {
        data += [ "$root_out_dir/vcruntime140_1${vcrt_suffix}.dll" ]
      }
      if (is_debug) {
        data += [ "$root_out_dir/ucrtbased.dll" ]
      }
      if (is_asan) {
        assert(target_cpu == "x64",
               "ASan is only supported in 64-bit builds on Windows.")
        data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
      }
    }
  }
}