1# Copyright 2015 The Chromium Authors. All rights reserved.
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    if (current_cpu != "arm64") {
40      # The UCRT files are not redistributable for ARM64 Win32.
41      outputs += [
42        "$root_out_dir/cdb/api-ms-win-core-console-l1-1-0.dll",
43        "$root_out_dir/cdb/api-ms-win-core-datetime-l1-1-0.dll",
44        "$root_out_dir/cdb/api-ms-win-core-debug-l1-1-0.dll",
45        "$root_out_dir/cdb/api-ms-win-core-errorhandling-l1-1-0.dll",
46        "$root_out_dir/cdb/api-ms-win-core-file-l1-1-0.dll",
47        "$root_out_dir/cdb/api-ms-win-core-file-l1-2-0.dll",
48        "$root_out_dir/cdb/api-ms-win-core-file-l2-1-0.dll",
49        "$root_out_dir/cdb/api-ms-win-core-handle-l1-1-0.dll",
50        "$root_out_dir/cdb/api-ms-win-core-heap-l1-1-0.dll",
51        "$root_out_dir/cdb/api-ms-win-core-interlocked-l1-1-0.dll",
52        "$root_out_dir/cdb/api-ms-win-core-libraryloader-l1-1-0.dll",
53        "$root_out_dir/cdb/api-ms-win-core-localization-l1-2-0.dll",
54        "$root_out_dir/cdb/api-ms-win-core-memory-l1-1-0.dll",
55        "$root_out_dir/cdb/api-ms-win-core-namedpipe-l1-1-0.dll",
56        "$root_out_dir/cdb/api-ms-win-core-processenvironment-l1-1-0.dll",
57        "$root_out_dir/cdb/api-ms-win-core-processthreads-l1-1-0.dll",
58        "$root_out_dir/cdb/api-ms-win-core-processthreads-l1-1-1.dll",
59        "$root_out_dir/cdb/api-ms-win-core-profile-l1-1-0.dll",
60        "$root_out_dir/cdb/api-ms-win-core-rtlsupport-l1-1-0.dll",
61        "$root_out_dir/cdb/api-ms-win-core-string-l1-1-0.dll",
62        "$root_out_dir/cdb/api-ms-win-core-synch-l1-1-0.dll",
63        "$root_out_dir/cdb/api-ms-win-core-synch-l1-2-0.dll",
64        "$root_out_dir/cdb/api-ms-win-core-sysinfo-l1-1-0.dll",
65        "$root_out_dir/cdb/api-ms-win-core-timezone-l1-1-0.dll",
66        "$root_out_dir/cdb/api-ms-win-core-util-l1-1-0.dll",
67        "$root_out_dir/cdb/api-ms-win-crt-conio-l1-1-0.dll",
68        "$root_out_dir/cdb/api-ms-win-crt-convert-l1-1-0.dll",
69        "$root_out_dir/cdb/api-ms-win-crt-environment-l1-1-0.dll",
70        "$root_out_dir/cdb/api-ms-win-crt-filesystem-l1-1-0.dll",
71        "$root_out_dir/cdb/api-ms-win-crt-heap-l1-1-0.dll",
72        "$root_out_dir/cdb/api-ms-win-crt-locale-l1-1-0.dll",
73        "$root_out_dir/cdb/api-ms-win-crt-math-l1-1-0.dll",
74        "$root_out_dir/cdb/api-ms-win-crt-multibyte-l1-1-0.dll",
75        "$root_out_dir/cdb/api-ms-win-crt-private-l1-1-0.dll",
76        "$root_out_dir/cdb/api-ms-win-crt-process-l1-1-0.dll",
77        "$root_out_dir/cdb/api-ms-win-crt-runtime-l1-1-0.dll",
78        "$root_out_dir/cdb/api-ms-win-crt-stdio-l1-1-0.dll",
79        "$root_out_dir/cdb/api-ms-win-crt-string-l1-1-0.dll",
80        "$root_out_dir/cdb/api-ms-win-crt-time-l1-1-0.dll",
81        "$root_out_dir/cdb/api-ms-win-crt-utility-l1-1-0.dll",
82        "$root_out_dir/cdb/api-ms-win-eventing-provider-l1-1-0.dll",
83        "$root_out_dir/cdb/ucrtbase.dll",
84      ]
85    }
86    args = [
87      rebase_path("$root_out_dir/cdb", root_out_dir),
88      current_cpu,
89    ]
90  }
91
92  group("runtime_libs") {
93    data = []
94    if (is_component_build) {
95      # Copy the VS runtime DLLs into the isolate so that they don't have to be
96      # preinstalled on the target machine. The debug runtimes have a "d" at
97      # the end.
98      if (is_debug) {
99        vcrt_suffix = "d"
100      } else {
101        vcrt_suffix = ""
102      }
103
104      # These runtime files are copied to the output directory by the
105      # vs_toolchain script that runs as part of toolchain configuration.
106      data += [
107        "$root_out_dir/msvcp140${vcrt_suffix}.dll",
108        "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
109        "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
110      ]
111      if (is_debug) {
112        data += [ "$root_out_dir/ucrtbased.dll" ]
113      }
114      if (is_asan) {
115        assert(target_cpu == "x64",
116               "ASan is only supported in 64-bit builds on Windows.")
117        data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
118      }
119      if (current_cpu != "arm64") {
120        data += [
121          # Universal Windows 10 CRT files
122          "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
123          "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
124          "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
125          "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
126          "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
127          "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
128          "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
129          "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
130          "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
131          "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
132          "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
133          "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
134          "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
135          "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
136          "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
137          "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
138          "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
139          "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
140          "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
141          "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
142          "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
143          "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
144          "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
145          "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
146          "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
147          "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
148          "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
149          "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
150          "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
151          "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
152          "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
153          "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
154          "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
155          "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
156          "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
157          "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
158          "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
159          "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
160          "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
161          "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
162        ]
163        if (!is_debug) {
164          data += [ "$root_out_dir/ucrtbase.dll" ]
165        }
166      }
167    }
168  }
169}
170