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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 exec_script("../../vs_toolchain.py", | 43 exec_script("../../vs_toolchain.py", |
44 [ | 44 [ |
45 "copy_dlls", | 45 "copy_dlls", |
46 rebase_path(root_build_dir), | 46 rebase_path(root_build_dir), |
47 configuration_name, | 47 configuration_name, |
48 target_cpu, | 48 target_cpu, |
49 ]) | 49 ]) |
50 } | 50 } |
51 | 51 |
52 # Parameters: | 52 # Parameters: |
53 # current_cpu: current_cpu to pass as a build arg | 53 # toolchain_cpu: current_cpu to pass as a build arg |
54 # current_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 | 64 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 tool("rc") { | 101 tool("rc") { |
102 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{
include_dirs}} /fo{{output}} {{source}}" | 102 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{
include_dirs}} /fo{{output}} {{source}}" |
103 outputs = [ | 103 outputs = [ |
104 "$object_subdir/{{source_name_part}}.res", | 104 "$object_subdir/{{source_name_part}}.res", |
105 ] | 105 ] |
106 description = "RC {{output}}" | 106 description = "RC {{output}}" |
107 } | 107 } |
108 | 108 |
109 tool("asm") { | 109 tool("asm") { |
110 if (current_cpu == "x64") { | 110 if (invoker.toolchain_cpu == "x64") { |
111 ml = "ml64.exe" | 111 ml = "ml64.exe" |
112 } else { | 112 } else { |
113 ml = "ml.exe" | 113 ml = "ml.exe" |
114 } | 114 } |
115 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in
clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" | 115 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in
clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" |
116 description = "ASM {{output}}" | 116 description = "ASM {{output}}" |
117 outputs = [ | 117 outputs = [ |
118 "$object_subdir/{{source_name_part}}.obj", | 118 "$object_subdir/{{source_name_part}}.obj", |
119 ] | 119 ] |
120 } | 120 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 description = stamp_description | 214 description = stamp_description |
215 } | 215 } |
216 tool("copy") { | 216 tool("copy") { |
217 command = copy_command | 217 command = copy_command |
218 description = copy_description | 218 description = copy_description |
219 } | 219 } |
220 | 220 |
221 # When invoking this toolchain not as the default one, these args will be | 221 # When invoking this toolchain not as the default one, these args will be |
222 # passed to the build. They are ignored when this is the default toolchain. | 222 # passed to the build. They are ignored when this is the default toolchain. |
223 toolchain_args() { | 223 toolchain_args() { |
224 current_cpu = invoker.current_cpu | 224 current_cpu = invoker.toolchain_cpu |
| 225 if (defined(invoker.toolchain_os)) { |
| 226 current_os = invoker.toolchain_os |
| 227 } |
225 if (defined(invoker.is_clang)) { | 228 if (defined(invoker.is_clang)) { |
226 is_clang = invoker.is_clang | 229 is_clang = invoker.is_clang |
227 } | 230 } |
228 current_os = invoker.current_os | |
229 | 231 |
230 # This value needs to be passed through unchanged. | 232 # This value needs to be passed through unchanged. |
231 host_toolchain = host_toolchain | 233 host_toolchain = host_toolchain |
232 } | 234 } |
233 } | 235 } |
234 } | 236 } |
235 | 237 |
236 # 32-bit toolchains. Only define these when the target architecture is 32-bit | 238 # 32-bit toolchains. Only define these when the target architecture is 32-bit |
237 # since we don't do any 32-bit cross compiles when targeting 64-bit (the | 239 # since we don't do any 32-bit cross compiles when targeting 64-bit (the |
238 # build does generate some 64-bit stuff from 32-bit target builds). | 240 # build does generate some 64-bit stuff from 32-bit target builds). |
239 if (target_cpu == "x86") { | 241 if (target_cpu == "x86") { |
240 x86_toolchain_data = exec_script("setup_toolchain.py", | 242 x86_toolchain_data = exec_script("setup_toolchain.py", |
241 [ | 243 [ |
242 visual_studio_path, | 244 visual_studio_path, |
243 gyp_win_tool_path, | 245 gyp_win_tool_path, |
244 windows_sdk_path, | 246 windows_sdk_path, |
245 visual_studio_runtime_dirs, | 247 visual_studio_runtime_dirs, |
246 "x86", | 248 "x86", |
247 ], | 249 ], |
248 "scope") | 250 "scope") |
249 | 251 |
250 msvc_toolchain("x86") { | 252 msvc_toolchain("x86") { |
251 environment = "environment.x86" | 253 environment = "environment.x86" |
252 current_cpu = "x86" | 254 toolchain_cpu = "x86" |
253 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" | 255 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" |
254 is_clang = false | 256 is_clang = false |
255 } | 257 } |
256 | 258 |
257 msvc_toolchain("clang_x86") { | 259 msvc_toolchain("clang_x86") { |
258 environment = "environment.x86" | 260 environment = "environment.x86" |
259 current_cpu = "x86" | 261 toolchain_cpu = "x86" |
260 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", | 262 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
261 root_build_dir) | 263 root_build_dir) |
262 cl = "${goma_prefix}$prefix/clang-cl.exe" | 264 cl = "${goma_prefix}$prefix/clang-cl.exe" |
263 current_os = "win" | 265 toolchain_os = "win" |
264 is_clang = true | 266 is_clang = true |
265 } | 267 } |
266 } | 268 } |
267 | 269 |
268 # 64-bit toolchains. | 270 # 64-bit toolchains. |
269 x64_toolchain_data = exec_script("setup_toolchain.py", | 271 x64_toolchain_data = exec_script("setup_toolchain.py", |
270 [ | 272 [ |
271 visual_studio_path, | 273 visual_studio_path, |
272 gyp_win_tool_path, | 274 gyp_win_tool_path, |
273 windows_sdk_path, | 275 windows_sdk_path, |
274 visual_studio_runtime_dirs, | 276 visual_studio_runtime_dirs, |
275 "x64", | 277 "x64", |
276 ], | 278 ], |
277 "scope") | 279 "scope") |
278 | 280 |
279 msvc_toolchain("x64") { | 281 msvc_toolchain("x64") { |
280 environment = "environment.x64" | 282 environment = "environment.x64" |
281 current_cpu = "x64" | 283 toolchain_cpu = "x64" |
282 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" | 284 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" |
283 is_clang = false | 285 is_clang = false |
284 } | 286 } |
285 | 287 |
286 msvc_toolchain("clang_x64") { | 288 msvc_toolchain("clang_x64") { |
287 environment = "environment.x64" | 289 environment = "environment.x64" |
288 current_cpu = "x64" | 290 toolchain_cpu = "x64" |
289 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", | 291 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
290 root_build_dir) | 292 root_build_dir) |
291 cl = "${goma_prefix}$prefix/clang-cl.exe" | 293 cl = "${goma_prefix}$prefix/clang-cl.exe" |
292 current_os = "win" | 294 toolchain_os = "win" |
293 is_clang = true | 295 is_clang = true |
294 } | 296 } |
295 | 297 |
296 # WinRT toolchains. Only define these when targeting them. | 298 # WinRT toolchains. Only define these when targeting them. |
297 # | 299 # |
298 # NOTE: This is currently broken because it references vc_bin_dir. brettw@ | 300 # NOTE: This is currently broken because it references vc_bin_dir. brettw@ |
299 # changed this around a bit, and I don't know what this should be set to | 301 # changed this around a bit, and I don't know what this should be set to |
300 # in terms of what setup_toolchain returns for a certain CPU architecture. | 302 # in terms of what setup_toolchain returns for a certain CPU architecture. |
301 if (target_os == "winrt_81" || target_os == "winrt_81_phone" || | 303 if (target_os == "winrt_81" || target_os == "winrt_81_phone" || |
302 target_os == "winrt_10") { | 304 target_os == "winrt_10") { |
303 msvc_toolchain("winrt_x86") { | 305 msvc_toolchain("winrt_x86") { |
304 environment = "environment.winrt_x86" | 306 environment = "environment.winrt_x86" |
305 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 307 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" |
306 is_clang = false | 308 is_clang = false |
307 | 309 |
308 current_cpu = "x86" | 310 toolchain_cpu = "x86" |
309 current_os = current_os | 311 toolchain_os = current_os |
310 } | 312 } |
311 | 313 |
312 msvc_toolchain("winrt_x64") { | 314 msvc_toolchain("winrt_x64") { |
313 environment = "environment.winrt_x64" | 315 environment = "environment.winrt_x64" |
314 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 316 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" |
315 is_clang = false | 317 is_clang = false |
316 | 318 |
317 current_cpu = "x64" | 319 toolchain_cpu = "x64" |
318 current_os = current_os | 320 toolchain_os = current_os |
319 } | 321 } |
320 } | 322 } |
OLD | NEW |