xref: /aosp_15_r20/external/cronet/build/win/BUILD.gn (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2015 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/clang/clang.gni")
6import("//build/config/sanitizers/sanitizers.gni")
7import("//build/config/win/manifest.gni")
8
9# Depending on this target will cause the manifests for Chrome's default
10# Windows and common control compatibility and elevation for executables.
11windows_manifest("default_exe_manifest") {
12  sources = [
13    as_invoker_manifest,
14    common_controls_manifest,
15    default_compatibility_manifest,
16  ]
17}
18
19if (is_win) {
20  assert(host_os != "mac" || target_cpu != "x86",
21         "Windows cross-builds from Mac must be 64-bit.")
22
23  action("copy_cdb_to_output") {
24    script = "//build/win/copy_cdb_to_output.py"
25    inputs = [
26      script,
27      "//build/vs_toolchain.py",
28    ]
29    outputs = [
30      "$root_out_dir/cdb/cdb.exe",
31      "$root_out_dir/cdb/dbgeng.dll",
32      "$root_out_dir/cdb/dbghelp.dll",
33      "$root_out_dir/cdb/dbgmodel.dll",
34      "$root_out_dir/cdb/winext/ext.dll",
35      "$root_out_dir/cdb/winext/uext.dll",
36      "$root_out_dir/cdb/winxp/exts.dll",
37      "$root_out_dir/cdb/winxp/ntsdexts.dll",
38    ]
39    args = [
40      rebase_path("$root_out_dir/cdb", root_out_dir),
41      current_cpu,
42    ]
43  }
44
45  group("runtime_libs") {
46    # These are needed for any tests that need to decode stacks.
47    data = [
48      "$root_out_dir/dbghelp.dll",
49      "$root_out_dir/dbgcore.dll",
50    ]
51    if (is_component_build) {
52      # Copy the VS runtime DLLs into the isolate so that they don't have to be
53      # preinstalled on the target machine. The debug runtimes have a "d" at
54      # the end.
55      if (is_debug) {
56        vcrt_suffix = "d"
57      } else {
58        vcrt_suffix = ""
59      }
60
61      # These runtime files are copied to the output directory by the
62      # vs_toolchain script that runs as part of toolchain configuration.
63      data += [
64        "$root_out_dir/msvcp140${vcrt_suffix}.dll",
65        "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
66        "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
67      ]
68      if (current_cpu == "x64") {
69        data += [ "$root_out_dir/vcruntime140_1${vcrt_suffix}.dll" ]
70      }
71      if (is_debug) {
72        data += [ "$root_out_dir/ucrtbased.dll" ]
73      }
74      if (is_asan) {
75        assert(target_cpu == "x64",
76               "ASan is only supported in 64-bit builds on Windows.")
77        data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
78      }
79    }
80  }
81}
82