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 declare_args() { | 5 declare_args() { |
6 # Path to the directory containing the VC binaries for the right | 6 # Path to the directory containing the VC binaries for the right |
7 # combination of host and target architectures. Currently only the | 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. | 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 | 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. | 10 # isn't), we will dynamically determine the right value to use at runtime. |
(...skipping 21 matching lines...) Expand all Loading... |
32 windows_sdk_path, | 32 windows_sdk_path, |
33 visual_studio_runtime_dirs, | 33 visual_studio_runtime_dirs, |
34 current_cpu, | 34 current_cpu, |
35 ], | 35 ], |
36 "scope") | 36 "scope") |
37 | 37 |
38 if (vc_bin_dir == "") { | 38 if (vc_bin_dir == "") { |
39 vc_bin_dir = toolchain_data.vc_bin_dir | 39 vc_bin_dir = toolchain_data.vc_bin_dir |
40 } | 40 } |
41 | 41 |
| 42 if (use_goma) { |
| 43 goma_prefix = "$goma_dir/gomacc.exe " |
| 44 } else { |
| 45 goma_prefix = "" |
| 46 } |
| 47 |
42 # This value will be inherited in the toolchain below. | 48 # This value will be inherited in the toolchain below. |
43 concurrent_links = exec_script("../get_concurrent_links.py", [], "value") | 49 concurrent_links = exec_script("../get_concurrent_links.py", [], "value") |
44 | 50 |
45 # Parameters: | 51 # Parameters: |
46 # current_cpu: current_cpu to pass as a build arg | 52 # current_cpu: current_cpu to pass as a build arg |
47 # environment: File name of environment file. | 53 # environment: File name of environment file. |
48 template("msvc_toolchain") { | 54 template("msvc_toolchain") { |
49 if (defined(invoker.concurrent_links)) { | 55 if (defined(invoker.concurrent_links)) { |
50 concurrent_links = invoker.concurrent_links | 56 concurrent_links = invoker.concurrent_links |
51 } | 57 } |
52 | 58 |
53 env = invoker.environment | 59 env = invoker.environment |
54 | 60 |
55 if (is_debug) { | 61 if (is_debug) { |
56 configuration = "Debug" | 62 configuration = "Debug" |
57 } else { | 63 } else { |
58 configuration = "Release" | 64 configuration = "Release" |
59 } | 65 } |
60 exec_script("../../vs_toolchain.py", | 66 exec_script("../../vs_toolchain.py", |
61 [ | 67 [ |
62 "copy_dlls", | 68 "copy_dlls", |
63 rebase_path(root_build_dir), | 69 rebase_path(root_build_dir), |
64 configuration, | 70 configuration, |
65 invoker.current_cpu, | 71 invoker.current_cpu, |
66 ]) | 72 ]) |
67 | 73 |
68 if (use_goma) { | 74 cl = invoker.cl |
69 goma_prefix = "$goma_dir/gomacc.exe " | |
70 } else { | |
71 goma_prefix = "" | |
72 } | |
73 | |
74 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | |
75 | 75 |
76 toolchain(target_name) { | 76 toolchain(target_name) { |
77 # Make these apply to all tools below. | 77 # Make these apply to all tools below. |
78 lib_switch = "" | 78 lib_switch = "" |
79 lib_dir_switch = "/LIBPATH:" | 79 lib_dir_switch = "/LIBPATH:" |
80 | 80 |
81 tool("cc") { | 81 tool("cc") { |
82 rspfile = "{{output}}.rsp" | 82 rspfile = "{{output}}.rsp" |
83 pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb" | 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" | 84 command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfil
e /c {{source}} /Fo{{output}} /Fd$pdbname" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 tool("copy") { | 194 tool("copy") { |
195 command = | 195 command = |
196 "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}" | 196 "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}" |
197 description = "COPY {{source}} {{output}}" | 197 description = "COPY {{source}} {{output}}" |
198 } | 198 } |
199 | 199 |
200 # When invoking this toolchain not as the default one, these args will be | 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. | 201 # passed to the build. They are ignored when this is the default toolchain. |
202 toolchain_args() { | 202 toolchain_args() { |
203 current_cpu = invoker.current_cpu | 203 current_cpu = invoker.current_cpu |
| 204 if (defined(invoker.is_clang)) { |
| 205 is_clang = invoker.is_clang |
| 206 } |
204 } | 207 } |
205 } | 208 } |
206 } | 209 } |
207 | 210 |
208 # TODO(dpranke): Declare both toolchains all of the time when we | 211 # TODO(dpranke): Declare both toolchains all of the time when we |
209 # get it sorted out how we want to support them both in a single build. | 212 # get it sorted out how we want to support them both in a single build. |
210 # Right now only one of these can be enabled at a time because the | 213 # Right now only one of these can be enabled at a time because the |
211 # runtime libraries get copied to root_build_dir and would collide. | 214 # runtime libraries get copied to root_build_dir and would collide. |
212 if (current_cpu == "x86") { | 215 if (current_cpu == "x86") { |
213 msvc_toolchain("32") { | 216 msvc_toolchain("x86") { |
214 environment = "environment.x86" | 217 environment = "environment.x86" |
215 | |
216 current_cpu = "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 |
217 } | 229 } |
218 } | 230 } |
219 | 231 |
220 if (current_cpu == "x64") { | 232 if (current_cpu == "x64") { |
221 msvc_toolchain("64") { | 233 msvc_toolchain("x64") { |
222 environment = "environment.x64" | 234 environment = "environment.x64" |
223 | |
224 current_cpu = "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 |
225 } | 246 } |
226 } | 247 } |
OLD | NEW |