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/sanitizers/sanitizers.gni") | 5 import("//build/config/sanitizers/sanitizers.gni") |
6 import("//build/config/win/visual_studio_version.gni") | 6 import("//build/config/win/visual_studio_version.gni") |
7 import("//build/toolchain/goma.gni") | 7 import("//build/toolchain/goma.gni") |
8 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
9 | 9 |
10 # Should only be running on Windows. | 10 # Should only be running on Windows. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 # toolchain_os: current_os to pass as a build arg | 54 # toolchain_os: current_os to pass as a build arg |
55 # environment: File name of environment file. | 55 # environment: File name of environment file. |
56 template("msvc_toolchain") { | 56 template("msvc_toolchain") { |
57 if (defined(invoker.concurrent_links)) { | 57 if (defined(invoker.concurrent_links)) { |
58 concurrent_links = invoker.concurrent_links | 58 concurrent_links = invoker.concurrent_links |
59 } | 59 } |
60 | 60 |
61 env = invoker.environment | 61 env = invoker.environment |
62 | 62 |
63 cl = invoker.cl | 63 cl = invoker.cl |
64 include_flags = invoker.include_flags | |
64 | 65 |
65 toolchain(target_name) { | 66 toolchain(target_name) { |
66 # Make these apply to all tools below. | 67 # Make these apply to all tools below. |
67 lib_switch = "" | 68 lib_switch = "" |
68 lib_dir_switch = "/LIBPATH:" | 69 lib_dir_switch = "/LIBPATH:" |
69 | 70 |
70 # Object files go in this directory. | 71 # Object files go in this directory. |
71 object_subdir = "{{target_out_dir}}/{{label_name}}" | 72 object_subdir = "{{target_out_dir}}/{{label_name}}" |
72 | 73 |
73 tool("cc") { | 74 tool("cc") { |
74 rspfile = "{{output}}.rsp" | 75 rspfile = "{{output}}.rsp" |
75 precompiled_header_type = "msvc" | 76 precompiled_header_type = "msvc" |
76 pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" | 77 pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" |
77 command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfil e /c {{source}} /Fo{{output}} /Fd$pdbname" | 78 command = "$cl /nologo $include_flags /showIncludes /FC @$rspfile /c {{sou rce}} /Fo{{output}} /Fd$pdbname" |
scottmg
2016/02/25 03:40:15
I don't understand how cl.exe gets PATH to be set
Nico
2016/02/25 03:45:41
We don't need the path. cl is set to `cl = "${goma
scottmg
2016/02/25 18:16:23
Are you sure? Looking in VC\bin\amd64_x86, there's
| |
78 depsformat = "msvc" | 79 depsformat = "msvc" |
79 description = "CC {{output}}" | 80 description = "CC {{output}}" |
80 outputs = [ | 81 outputs = [ |
81 "$object_subdir/{{source_name_part}}.obj", | 82 "$object_subdir/{{source_name_part}}.obj", |
82 ] | 83 ] |
83 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}" | 84 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}" |
84 } | 85 } |
85 | 86 |
86 tool("cxx") { | 87 tool("cxx") { |
87 rspfile = "{{output}}.rsp" | 88 rspfile = "{{output}}.rsp" |
88 precompiled_header_type = "msvc" | 89 precompiled_header_type = "msvc" |
89 | 90 |
90 # The PDB name needs to be different between C and C++ compiled files. | 91 # The PDB name needs to be different between C and C++ compiled files. |
91 pdbname = "{{target_out_dir}}/{{label_name}}_cc.pdb" | 92 pdbname = "{{target_out_dir}}/{{label_name}}_cc.pdb" |
92 command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfil e /c {{source}} /Fo{{output}} /Fd$pdbname" | 93 command = "$cl /nologo $include_flags /showIncludes /FC @$rspfile /c {{sou rce}} /Fo{{output}} /Fd$pdbname" |
93 depsformat = "msvc" | 94 depsformat = "msvc" |
94 description = "CXX {{output}}" | 95 description = "CXX {{output}}" |
95 outputs = [ | 96 outputs = [ |
96 "$object_subdir/{{source_name_part}}.obj", | 97 "$object_subdir/{{source_name_part}}.obj", |
97 ] | 98 ] |
98 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}" | 99 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}" |
99 } | 100 } |
100 | 101 |
101 tool("rc") { | 102 tool("rc") { |
102 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{ include_dirs}} /fo{{output}} {{source}}" | 103 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{ include_dirs}} /fo{{output}} {{source}}" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 "is_clang", | 233 "is_clang", |
233 "is_component_build", | 234 "is_component_build", |
234 ]) | 235 ]) |
235 | 236 |
236 # This value needs to be passed through unchanged. | 237 # This value needs to be passed through unchanged. |
237 host_toolchain = host_toolchain | 238 host_toolchain = host_toolchain |
238 } | 239 } |
239 } | 240 } |
240 } | 241 } |
241 | 242 |
243 if (is_clang) { | |
244 sys_include_prefix = "-isystem=" | |
245 } else { | |
246 # MSVC doesn't have the concept of system headers. | |
247 sys_include_prefix = "/I" | |
248 } | |
249 | |
242 if (host_os == "win") { | 250 if (host_os == "win") { |
243 clang_cl = "clang-cl.exe" | 251 clang_cl = "clang-cl.exe" |
244 } else { | 252 } else { |
245 clang_cl = "clang-cl" | 253 clang_cl = "clang-cl" |
246 } | 254 } |
247 | 255 |
248 # 32-bit toolchains. Only define these when the target architecture is 32-bit | 256 # 32-bit toolchains. Only define these when the target architecture is 32-bit |
249 # since we don't do any 32-bit cross compiles when targeting 64-bit (the | 257 # since we don't do any 32-bit cross compiles when targeting 64-bit (the |
250 # build does generate some 64-bit stuff from 32-bit target builds). | 258 # build does generate some 64-bit stuff from 32-bit target builds). |
251 if (target_cpu == "x86") { | 259 if (target_cpu == "x86") { |
252 x86_toolchain_data = exec_script("setup_toolchain.py", | 260 x86_toolchain_data = exec_script("setup_toolchain.py", |
253 [ | 261 [ |
254 visual_studio_path, | 262 visual_studio_path, |
255 gyp_win_tool_path, | 263 gyp_win_tool_path, |
256 windows_sdk_path, | 264 windows_sdk_path, |
257 visual_studio_runtime_dirs, | 265 visual_studio_runtime_dirs, |
258 "x86", | 266 "x86", |
267 "${sys_include_prefix}", | |
259 ], | 268 ], |
260 "scope") | 269 "scope") |
261 | 270 |
262 msvc_toolchain("x86") { | 271 msvc_toolchain("x86") { |
263 environment = "environment.x86" | 272 environment = "environment.x86" |
264 toolchain_cpu = "x86" | 273 toolchain_cpu = "x86" |
265 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" | 274 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" |
266 is_clang = false | 275 is_clang = false |
276 include_flags = "${x86_toolchain_data.include_flags}" | |
267 } | 277 } |
268 | 278 |
269 msvc_toolchain("clang_x86") { | 279 msvc_toolchain("clang_x86") { |
270 environment = "environment.x86" | 280 environment = "environment.x86" |
271 toolchain_cpu = "x86" | 281 toolchain_cpu = "x86" |
272 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", | 282 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
273 root_build_dir) | 283 root_build_dir) |
274 cl = "${goma_prefix}$prefix/${clang_cl}" | 284 cl = "${goma_prefix}$prefix/${clang_cl}" |
275 toolchain_os = "win" | 285 toolchain_os = "win" |
276 is_clang = true | 286 is_clang = true |
287 include_flags = "${x86_toolchain_data.include_flags}" | |
277 } | 288 } |
278 } | 289 } |
279 | 290 |
280 # 64-bit toolchains. | 291 # 64-bit toolchains. |
281 x64_toolchain_data = exec_script("setup_toolchain.py", | 292 x64_toolchain_data = exec_script("setup_toolchain.py", |
282 [ | 293 [ |
283 visual_studio_path, | 294 visual_studio_path, |
284 gyp_win_tool_path, | 295 gyp_win_tool_path, |
285 windows_sdk_path, | 296 windows_sdk_path, |
286 visual_studio_runtime_dirs, | 297 visual_studio_runtime_dirs, |
287 "x64", | 298 "x64", |
299 "${sys_include_prefix}", | |
288 ], | 300 ], |
289 "scope") | 301 "scope") |
290 | 302 |
291 template("win_x64_toolchains") { | 303 template("win_x64_toolchains") { |
292 # TODO(mcgrathr): These assignments are only required because of | 304 # TODO(mcgrathr): These assignments are only required because of |
293 # crbug.com/395883. Drop them if that ever gets fixed in GN. | 305 # crbug.com/395883. Drop them if that ever gets fixed in GN. |
294 concurrent_links = invoker.concurrent_links | 306 concurrent_links = invoker.concurrent_links |
295 goma_prefix = invoker.goma_prefix | 307 goma_prefix = invoker.goma_prefix |
296 x64_toolchain_data = invoker.x64_toolchain_data | 308 x64_toolchain_data = invoker.x64_toolchain_data |
297 clang_cl = invoker.clang_cl | 309 clang_cl = invoker.clang_cl |
298 | 310 |
299 msvc_toolchain(target_name) { | 311 msvc_toolchain(target_name) { |
300 environment = "environment.x64" | 312 environment = "environment.x64" |
301 toolchain_cpu = "x64" | 313 toolchain_cpu = "x64" |
302 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" | 314 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" |
303 is_clang = false | 315 is_clang = false |
316 include_flags = "${x64_toolchain_data.include_flags}" | |
304 | 317 |
305 forward_variables_from(invoker, [ "is_component_build" ]) | 318 forward_variables_from(invoker, [ "is_component_build" ]) |
306 } | 319 } |
307 | 320 |
308 msvc_toolchain("clang_" + target_name) { | 321 msvc_toolchain("clang_" + target_name) { |
309 environment = "environment.x64" | 322 environment = "environment.x64" |
310 toolchain_cpu = "x64" | 323 toolchain_cpu = "x64" |
311 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", | 324 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
312 root_build_dir) | 325 root_build_dir) |
313 cl = "${goma_prefix}$prefix/${clang_cl}" | 326 cl = "${goma_prefix}$prefix/${clang_cl}" |
314 toolchain_os = "win" | 327 toolchain_os = "win" |
315 is_clang = true | 328 is_clang = true |
329 include_flags = "${x64_toolchain_data.include_flags}" | |
316 | 330 |
317 forward_variables_from(invoker, [ "is_component_build" ]) | 331 forward_variables_from(invoker, [ "is_component_build" ]) |
318 } | 332 } |
319 } | 333 } |
320 | 334 |
321 win_x64_toolchains("x64") { | 335 win_x64_toolchains("x64") { |
322 # TODO(mcgrathr): These assignments are only required because of | 336 # TODO(mcgrathr): These assignments are only required because of |
323 # crbug.com/395883. Drop them if that ever gets fixed in GN. | 337 # crbug.com/395883. Drop them if that ever gets fixed in GN. |
324 concurrent_links = concurrent_links | 338 concurrent_links = concurrent_links |
325 goma_prefix = goma_prefix | 339 goma_prefix = goma_prefix |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 | 374 |
361 msvc_toolchain("winrt_x64") { | 375 msvc_toolchain("winrt_x64") { |
362 environment = "environment.winrt_x64" | 376 environment = "environment.winrt_x64" |
363 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 377 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" |
364 is_clang = false | 378 is_clang = false |
365 | 379 |
366 toolchain_cpu = "x64" | 380 toolchain_cpu = "x64" |
367 toolchain_os = current_os | 381 toolchain_os = current_os |
368 } | 382 } |
369 } | 383 } |
OLD | NEW |