OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/clang/clang.gni") | 5 import("//build/config/clang/clang.gni") |
6 import("//build/config/compiler/compiler.gni") | 6 import("//build/config/compiler/compiler.gni") |
7 import("//build/config/sanitizers/sanitizers.gni") | 7 import("//build/config/sanitizers/sanitizers.gni") |
8 import("//build/config/win/visual_studio_version.gni") | 8 import("//build/config/win/visual_studio_version.gni") |
9 import("//build/toolchain/goma.gni") | 9 import("//build/toolchain/goma.gni") |
10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
11 | 11 |
12 # Should only be running on Windows. | 12 # Should only be running on Windows. |
13 assert(is_win) | 13 assert(is_win) |
14 | 14 |
15 # Setup the Visual Studio state. | 15 # Setup the Visual Studio state. |
16 # | 16 # |
17 # Its arguments are the VS path and the compiler wrapper tool. It will write | 17 # Its arguments are the VS path and the compiler wrapper tool. It will write |
18 # "environment.x86" and "environment.x64" to the build directory and return a | 18 # "environment.x86" and "environment.x64" to the build directory and return a |
19 # list to us. | 19 # list to us. |
20 gyp_win_tool_path = | 20 |
21 rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir) | 21 # This tool will get copied to the build directory and wraps some common |
22 # commands. | |
23 tool_wrapper_path = rebase_path("tool_wrapper.py", root_build_dir) | |
scottmg
2016/08/26 20:54:36
We are going to still copy it? So now using it fro
brettw
2016/08/26 20:57:07
It's not copied. This is rebasing the path "tool_w
scottmg
2016/08/26 20:59:04
OK, I was misled by the prominent comment directly
brettw
2016/08/26 21:00:27
Whoops, fixed!
| |
22 | 24 |
23 if (use_goma) { | 25 if (use_goma) { |
24 goma_prefix = "$goma_dir/gomacc.exe " | 26 goma_prefix = "$goma_dir/gomacc.exe " |
25 } else { | 27 } else { |
26 goma_prefix = "" | 28 goma_prefix = "" |
27 } | 29 } |
28 | 30 |
29 # Copy the VS runtime DLL for the default toolchain to the root build directory | 31 # Copy the VS runtime DLL for the default toolchain to the root build directory |
30 # so things will run. | 32 # so things will run. |
31 if (current_toolchain == default_toolchain) { | 33 if (current_toolchain == default_toolchain) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 command = "$env_wrapper$cl /nologo /showIncludes /FC @$rspfile /c {{source }} /Fo{{output}} /Fd\"$pdbname\"" | 155 command = "$env_wrapper$cl /nologo /showIncludes /FC @$rspfile /c {{source }} /Fo{{output}} /Fd\"$pdbname\"" |
154 depsformat = "msvc" | 156 depsformat = "msvc" |
155 description = "CXX {{output}}" | 157 description = "CXX {{output}}" |
156 outputs = [ | 158 outputs = [ |
157 "$object_subdir/{{source_name_part}}.obj", | 159 "$object_subdir/{{source_name_part}}.obj", |
158 ] | 160 ] |
159 rspfile_content = "$sys_include_flags{{defines}} {{include_dirs}} {{cflags }} {{cflags_cc}}" | 161 rspfile_content = "$sys_include_flags{{defines}} {{include_dirs}} {{cflags }} {{cflags_cc}}" |
160 } | 162 } |
161 | 163 |
162 tool("rc") { | 164 tool("rc") { |
163 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{ include_dirs}} /fo{{output}} {{source}}" | 165 command = "$python_path $tool_wrapper_path rc-wrapper $env rc.exe {{define s}} {{include_dirs}} /fo{{output}} {{source}}" |
164 outputs = [ | 166 outputs = [ |
165 "$object_subdir/{{source_name_part}}.res", | 167 "$object_subdir/{{source_name_part}}.res", |
166 ] | 168 ] |
167 description = "RC {{output}}" | 169 description = "RC {{output}}" |
168 } | 170 } |
169 | 171 |
170 tool("asm") { | 172 tool("asm") { |
171 if (toolchain_args.current_cpu == "x64") { | 173 if (toolchain_args.current_cpu == "x64") { |
172 ml = "ml64.exe" | 174 ml = "ml64.exe" |
173 } else { | 175 } else { |
174 ml = "ml.exe" | 176 ml = "ml.exe" |
175 } | 177 } |
176 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" | 178 command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{defines} } {{include_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" |
177 description = "ASM {{output}}" | 179 description = "ASM {{output}}" |
178 outputs = [ | 180 outputs = [ |
179 "$object_subdir/{{source_name_part}}.obj", | 181 "$object_subdir/{{source_name_part}}.obj", |
180 ] | 182 ] |
181 } | 183 } |
182 | 184 |
183 tool("alink") { | 185 tool("alink") { |
184 rspfile = "{{output}}.rsp" | 186 rspfile = "{{output}}.rsp" |
185 command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo {{arflags}} /OUT:{{output}} @$rspfile" | 187 command = "$python_path $tool_wrapper_path link-wrapper $env False $lib /n ologo {{arflags}} /OUT:{{output}} @$rspfile" |
186 description = "LIB {{output}}" | 188 description = "LIB {{output}}" |
187 outputs = [ | 189 outputs = [ |
188 # Ignore {{output_extension}} and always use .lib, there's no reason to | 190 # Ignore {{output_extension}} and always use .lib, there's no reason to |
189 # allow targets to override this extension on Windows. | 191 # allow targets to override this extension on Windows. |
190 "{{output_dir}}/{{target_output_name}}.lib", | 192 "{{output_dir}}/{{target_output_name}}.lib", |
191 ] | 193 ] |
192 default_output_extension = ".lib" | 194 default_output_extension = ".lib" |
193 default_output_dir = "{{target_out_dir}}" | 195 default_output_dir = "{{target_out_dir}}" |
194 | 196 |
195 # The use of inputs_newline is to work around a fixed per-line buffer | 197 # The use of inputs_newline is to work around a fixed per-line buffer |
196 # size in the linker. | 198 # size in the linker. |
197 rspfile_content = "{{inputs_newline}}" | 199 rspfile_content = "{{inputs_newline}}" |
198 } | 200 } |
199 | 201 |
200 tool("solink") { | 202 tool("solink") { |
201 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e .g. foo.dll | 203 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e .g. foo.dll |
202 libname = "${dllname}.lib" # e.g. foo.dll.lib | 204 libname = "${dllname}.lib" # e.g. foo.dll.lib |
203 pdbname = "${dllname}.pdb" | 205 pdbname = "${dllname}.pdb" |
204 rspfile = "${dllname}.rsp" | 206 rspfile = "${dllname}.rsp" |
205 pool = "//build/toolchain:link_pool($default_toolchain)" | 207 pool = "//build/toolchain:link_pool($default_toolchain)" |
206 | 208 |
207 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 209 command = "$python_path $tool_wrapper_path link-wrapper $env False $link / nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
208 | 210 |
209 default_output_extension = ".dll" | 211 default_output_extension = ".dll" |
210 default_output_dir = "{{root_out_dir}}" | 212 default_output_dir = "{{root_out_dir}}" |
211 description = "LINK(DLL) {{output}}" | 213 description = "LINK(DLL) {{output}}" |
212 outputs = [ | 214 outputs = [ |
213 dllname, | 215 dllname, |
214 libname, | 216 libname, |
215 ] | 217 ] |
216 link_output = libname | 218 link_output = libname |
217 depend_output = libname | 219 depend_output = libname |
(...skipping 12 matching lines...) Expand all Loading... | |
230 # size in the linker. | 232 # size in the linker. |
231 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 233 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" |
232 } | 234 } |
233 | 235 |
234 tool("solink_module") { | 236 tool("solink_module") { |
235 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e .g. foo.dll | 237 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e .g. foo.dll |
236 pdbname = "${dllname}.pdb" | 238 pdbname = "${dllname}.pdb" |
237 rspfile = "${dllname}.rsp" | 239 rspfile = "${dllname}.rsp" |
238 pool = "//build/toolchain:link_pool($default_toolchain)" | 240 pool = "//build/toolchain:link_pool($default_toolchain)" |
239 | 241 |
240 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 242 command = "$python_path $tool_wrapper_path link-wrapper $env False $link / nologo /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
241 | 243 |
242 default_output_extension = ".dll" | 244 default_output_extension = ".dll" |
243 default_output_dir = "{{root_out_dir}}" | 245 default_output_dir = "{{root_out_dir}}" |
244 description = "LINK_MODULE(DLL) {{output}}" | 246 description = "LINK_MODULE(DLL) {{output}}" |
245 outputs = [ | 247 outputs = [ |
246 dllname, | 248 dllname, |
247 ] | 249 ] |
248 if (symbol_level != 0) { | 250 if (symbol_level != 0) { |
249 outputs += [ pdbname ] | 251 outputs += [ pdbname ] |
250 } | 252 } |
251 runtime_outputs = outputs | 253 runtime_outputs = outputs |
252 | 254 |
253 # The use of inputs_newline is to work around a fixed per-line buffer | 255 # The use of inputs_newline is to work around a fixed per-line buffer |
254 # size in the linker. | 256 # size in the linker. |
255 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 257 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" |
256 } | 258 } |
257 | 259 |
258 tool("link") { | 260 tool("link") { |
259 exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 261 exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
260 pdbname = "$exename.pdb" | 262 pdbname = "$exename.pdb" |
261 rspfile = "$exename.rsp" | 263 rspfile = "$exename.rsp" |
262 pool = "//build/toolchain:link_pool($default_toolchain)" | 264 pool = "//build/toolchain:link_pool($default_toolchain)" |
263 | 265 |
264 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo /OUT:$exename /PDB:$pdbname @$rspfile" | 266 command = "$python_path $tool_wrapper_path link-wrapper $env False $link / nologo /OUT:$exename /PDB:$pdbname @$rspfile" |
265 | 267 |
266 default_output_extension = ".exe" | 268 default_output_extension = ".exe" |
267 default_output_dir = "{{root_out_dir}}" | 269 default_output_dir = "{{root_out_dir}}" |
268 description = "LINK {{output}}" | 270 description = "LINK {{output}}" |
269 outputs = [ | 271 outputs = [ |
270 exename, | 272 exename, |
271 ] | 273 ] |
272 if (symbol_level != 0) { | 274 if (symbol_level != 0) { |
273 outputs += [ pdbname ] | 275 outputs += [ pdbname ] |
274 } | 276 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 clang_cl = "clang-cl" | 308 clang_cl = "clang-cl" |
307 } | 309 } |
308 | 310 |
309 # 32-bit toolchains. Only define these when the target architecture is 32-bit | 311 # 32-bit toolchains. Only define these when the target architecture is 32-bit |
310 # since we don't do any 32-bit cross compiles when targeting 64-bit (the | 312 # since we don't do any 32-bit cross compiles when targeting 64-bit (the |
311 # build does generate some 64-bit stuff from 32-bit target builds). | 313 # build does generate some 64-bit stuff from 32-bit target builds). |
312 if (target_cpu == "x86") { | 314 if (target_cpu == "x86") { |
313 x86_toolchain_data = exec_script("setup_toolchain.py", | 315 x86_toolchain_data = exec_script("setup_toolchain.py", |
314 [ | 316 [ |
315 visual_studio_path, | 317 visual_studio_path, |
316 gyp_win_tool_path, | |
317 windows_sdk_path, | 318 windows_sdk_path, |
318 visual_studio_runtime_dirs, | 319 visual_studio_runtime_dirs, |
319 "x86", | 320 "x86", |
320 "${sys_include_prefix}", | 321 "${sys_include_prefix}", |
321 ], | 322 ], |
322 "scope") | 323 "scope") |
323 | 324 |
324 msvc_toolchain("x86") { | 325 msvc_toolchain("x86") { |
325 environment = "environment.x86" | 326 environment = "environment.x86" |
326 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" | 327 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" |
(...skipping 13 matching lines...) Expand all Loading... | |
340 current_cpu = "x86" | 341 current_cpu = "x86" |
341 is_clang = true | 342 is_clang = true |
342 } | 343 } |
343 } | 344 } |
344 } | 345 } |
345 | 346 |
346 # 64-bit toolchains. | 347 # 64-bit toolchains. |
347 x64_toolchain_data = exec_script("setup_toolchain.py", | 348 x64_toolchain_data = exec_script("setup_toolchain.py", |
348 [ | 349 [ |
349 visual_studio_path, | 350 visual_studio_path, |
350 gyp_win_tool_path, | |
351 windows_sdk_path, | 351 windows_sdk_path, |
352 visual_studio_runtime_dirs, | 352 visual_studio_runtime_dirs, |
353 "x64", | 353 "x64", |
354 "${sys_include_prefix}", | 354 "${sys_include_prefix}", |
355 ], | 355 ], |
356 "scope") | 356 "scope") |
357 | 357 |
358 template("win_x64_toolchains") { | 358 template("win_x64_toolchains") { |
359 msvc_toolchain(target_name) { | 359 msvc_toolchain(target_name) { |
360 environment = "environment.x64" | 360 environment = "environment.x64" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 msvc_toolchain("winrt_x64") { | 422 msvc_toolchain("winrt_x64") { |
423 environment = "environment.winrt_x64" | 423 environment = "environment.winrt_x64" |
424 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 424 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" |
425 | 425 |
426 toolchain_args = { | 426 toolchain_args = { |
427 is_clang = false | 427 is_clang = false |
428 current_cpu = "x64" | 428 current_cpu = "x64" |
429 } | 429 } |
430 } | 430 } |
431 } | 431 } |
OLD | NEW |