Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: build/toolchain/win/BUILD.gn

Issue 1422333008: Remove Windows-related GN build configuration (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Review feedback addressed Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/toolchain/toolchain.gni ('k') | build/toolchain/win/midl.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2013 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
5 declare_args() {
6 # Path to the directory containing the VC binaries for the right
7 # combination of host and target architectures. Currently only the
8 # 64-bit host toolchain is supported, with either 32-bit or 64-bit targets.
9 # If vc_bin_dir is not specified on the command line (and it normally
10 # isn't), we will dynamically determine the right value to use at runtime.
11 vc_bin_dir = ""
12 }
13
14 import("//build/config/win/visual_studio_version.gni")
15 import("//build/toolchain/goma.gni")
16
17 # Should only be running on Windows.
18 assert(is_win)
19
20 # Setup the Visual Studio state.
21 #
22 # Its arguments are the VS path and the compiler wrapper tool. It will write
23 # "environment.x86" and "environment.x64" to the build directory and return a
24 # list to us.
25 gyp_win_tool_path =
26 rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir)
27
28 toolchain_data = exec_script("setup_toolchain.py",
29 [
30 visual_studio_path,
31 gyp_win_tool_path,
32 windows_sdk_path,
33 visual_studio_runtime_dirs,
34 current_cpu,
35 ],
36 "scope")
37
38 if (vc_bin_dir == "") {
39 vc_bin_dir = toolchain_data.vc_bin_dir
40 }
41
42 if (use_goma) {
43 goma_prefix = "$goma_dir/gomacc.exe "
44 } else {
45 goma_prefix = ""
46 }
47
48 # This value will be inherited in the toolchain below.
49 concurrent_links = exec_script("../get_concurrent_links.py", [], "value")
50
51 # Parameters:
52 # current_cpu: current_cpu to pass as a build arg
53 # environment: File name of environment file.
54 template("msvc_toolchain") {
55 if (defined(invoker.concurrent_links)) {
56 concurrent_links = invoker.concurrent_links
57 }
58
59 env = invoker.environment
60
61 if (is_debug) {
62 configuration = "Debug"
63 } else {
64 configuration = "Release"
65 }
66 exec_script("../../vs_toolchain.py",
67 [
68 "copy_dlls",
69 rebase_path(root_build_dir),
70 configuration,
71 invoker.current_cpu,
72 ])
73
74 cl = invoker.cl
75
76 toolchain(target_name) {
77 # Make these apply to all tools below.
78 lib_switch = ""
79 lib_dir_switch = "/LIBPATH:"
80
81 tool("cc") {
82 rspfile = "{{output}}.rsp"
83 pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb"
84 command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfil e /c {{source}} /Fo{{output}} /Fd$pdbname"
85 depsformat = "msvc"
86 description = "CC {{output}}"
87 outputs = [
88 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
89 ]
90 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
91 }
92
93 tool("cxx") {
94 rspfile = "{{output}}.rsp"
95
96 # The PDB name needs to be different between C and C++ compiled files.
97 pdbname = "{{target_out_dir}}/{{target_output_name}}_cc.pdb"
98 command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfil e /c {{source}} /Fo{{output}} /Fd$pdbname"
99 depsformat = "msvc"
100 description = "CXX {{output}}"
101 outputs = [
102 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
103 ]
104 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}"
105 }
106
107 tool("rc") {
108 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{ include_dirs}} /fo{{output}} {{source}}"
109 outputs = [
110 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.res",
111 ]
112 description = "RC {{output}}"
113 }
114
115 tool("asm") {
116 # TODO(brettw): "/safeseh" assembler argument is hardcoded here. Extract
117 # assembler flags to a variable like cflags. crbug.com/418613
118 command = "$python_path gyp-win-tool asm-wrapper $env ml.exe {{defines}} { {include_dirs}} /safeseh /c /Fo {{output}} {{source}}"
119 description = "ASM {{output}}"
120 outputs = [
121 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
122 ]
123 }
124
125 tool("alink") {
126 rspfile = "{{output}}.rsp"
127 command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nolo go /ignore:4221 /OUT:{{output}} @$rspfile"
128 description = "LIB {{output}}"
129 outputs = [
130 # Ignore {{output_extension}} and always use .lib, there's no reason to
131 # allow targets to override this extension on Windows.
132 "{{target_out_dir}}/{{target_output_name}}.lib",
133 ]
134 default_output_extension = ".lib"
135
136 # The use of inputs_newline is to work around a fixed per-line buffer
137 # size in the linker.
138 rspfile_content = "{{inputs_newline}}"
139 }
140
141 tool("solink") {
142 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
143 libname =
144 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.lib" # e .g. foo.dll.lib
145 rspfile = "${dllname}.rsp"
146
147 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
148
149 # TODO(brettw) support manifests
150 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:${dllname}.manifest"
151 #command = "cmd /c $link_command && $manifest_command"
152 command = link_command
153
154 default_output_extension = ".dll"
155 description = "LINK(DLL) {{output}}"
156 outputs = [
157 dllname,
158 libname,
159 ]
160 link_output = libname
161 depend_output = libname
162
163 # The use of inputs_newline is to work around a fixed per-line buffer
164 # size in the linker.
165 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
166 }
167
168 tool("link") {
169 rspfile = "{{output}}.rsp"
170
171 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile"
172
173 # TODO(brettw) support manifests
174 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:{{output}}.manifest"
175 #command = "cmd /c $link_command && $manifest_command"
176 command = link_command
177
178 default_output_extension = ".exe"
179 description = "LINK {{output}}"
180 outputs = [
181 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
182 ]
183
184 # The use of inputs_newline is to work around a fixed per-line buffer
185 # size in the linker.
186 rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
187 }
188
189 tool("stamp") {
190 command = "$python_path gyp-win-tool stamp {{output}}"
191 description = "STAMP {{output}}"
192 }
193
194 tool("copy") {
195 command =
196 "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}"
197 description = "COPY {{source}} {{output}}"
198 }
199
200 # When invoking this toolchain not as the default one, these args will be
201 # passed to the build. They are ignored when this is the default toolchain.
202 toolchain_args() {
203 current_cpu = invoker.current_cpu
204 if (defined(invoker.is_clang)) {
205 is_clang = invoker.is_clang
206 }
207 }
208 }
209 }
210
211 # TODO(dpranke): Declare both toolchains all of the time when we
212 # get it sorted out how we want to support them both in a single build.
213 # Right now only one of these can be enabled at a time because the
214 # runtime libraries get copied to root_build_dir and would collide.
215 if (current_cpu == "x86") {
216 msvc_toolchain("x86") {
217 environment = "environment.x86"
218 current_cpu = "x86"
219 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
220 is_clang = false
221 }
222 msvc_toolchain("clang_x86") {
223 environment = "environment.x86"
224 current_cpu = "x86"
225 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
226 root_build_dir)
227 cl = "${goma_prefix}$prefix/clang-cl.exe"
228 is_clang = true
229 }
230 }
231
232 if (current_cpu == "x64") {
233 msvc_toolchain("x64") {
234 environment = "environment.x64"
235 current_cpu = "x64"
236 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
237 is_clang = false
238 }
239 msvc_toolchain("clang_x64") {
240 environment = "environment.x64"
241 current_cpu = "x64"
242 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
243 root_build_dir)
244 cl = "${goma_prefix}$prefix/clang-cl.exe"
245 is_clang = true
246 }
247 }
OLDNEW
« no previous file with comments | « build/toolchain/toolchain.gni ('k') | build/toolchain/win/midl.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698