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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires | 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires |
6 # some enhancements since the commands on Mac are slightly different than on | 6 # some enhancements since the commands on Mac are slightly different than on |
7 # Linux. | 7 # Linux. |
8 | 8 |
9 import("../goma.gni") | 9 import("../goma.gni") |
10 import("//build/config/ios/ios_sdk.gni") | 10 import("//build/config/ios/ios_sdk.gni") |
11 import("//build/config/mac/mac_sdk.gni") | 11 import("//build/config/mac/mac_sdk.gni") |
12 import("//build/config/mac/symbols.gni") | 12 import("//build/config/mac/symbols.gni") |
13 | 13 |
14 assert(host_os == "mac") | 14 assert(host_os == "mac") |
15 | 15 |
16 import("//build/toolchain/goma.gni") | 16 import("//build/toolchain/goma.gni") |
17 import("//build/toolchain/toolchain.gni") | 17 import("//build/toolchain/toolchain.gni") |
18 import("//build/toolchain/concurrent_links.gni") | 18 import("//build/toolchain/concurrent_links.gni") |
19 | 19 |
20 if (use_goma) { | 20 if (use_goma) { |
21 goma_prefix = "$goma_dir/gomacc " | 21 goma_prefix = "$goma_dir/gomacc " |
22 } else { | 22 } else { |
23 goma_prefix = "" | 23 goma_prefix = "" |
24 } | 24 } |
25 | 25 |
26 declare_args() { | |
27 # Control the number of copy_bundle_data and compile_xcassets tasks to run | |
28 # simultaneously. As the tasks are doing lots of I/O, some limit is required | |
29 # to prevent I/O starvation when ninja is run with a large number of parallel | |
30 # jobs (e.g. when using distributed build like goma). | |
31 bundle_pool_depth = -1 | |
32 } | |
33 | |
34 if (current_toolchain == default_toolchain) { | |
35 # Reduce the number of tasks using the copy_bundle_data and compile_xcassets | |
36 # tools as they can cause lots of I/O contention when invoking ninja with a | |
37 # large number of parallel jobs (e.g. when using distributed build like goma). | |
38 pool("bundle_pool") { | |
39 if (bundle_pool_depth == -1) { | |
Dirk Pranke
2016/06/07 22:17:46
Can we just use the value of concurrent_links here
sdefresne
2016/06/08 08:04:27
Done.
| |
40 depth = | |
41 exec_script("//build/toolchain/get_concurrent_links.py", [], "value") | |
42 } else { | |
43 depth = bundle_pool_depth | |
44 } | |
45 } | |
46 } | |
47 | |
26 # This will copy the gyp-mac-tool to the build directory. We pass in the source | 48 # This will copy the gyp-mac-tool to the build directory. We pass in the source |
27 # file of the mac tool. | 49 # file of the mac tool. |
28 gyp_mac_tool_source = | 50 gyp_mac_tool_source = |
29 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir) | 51 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir) |
30 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ]) | 52 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ]) |
31 | 53 |
32 # Shared toolchain definition. Invocations should set toolchain_os to set the | 54 # Shared toolchain definition. Invocations should set toolchain_os to set the |
33 # build args in this definition. | 55 # build args in this definition. |
34 template("mac_toolchain") { | 56 template("mac_toolchain") { |
35 toolchain(target_name) { | 57 toolchain(target_name) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 tool("copy") { | 286 tool("copy") { |
265 command = copy_command | 287 command = copy_command |
266 description = copy_description | 288 description = copy_description |
267 } | 289 } |
268 | 290 |
269 tool("copy_bundle_data") { | 291 tool("copy_bundle_data") { |
270 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", | 292 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", |
271 root_build_dir) | 293 root_build_dir) |
272 command = "python $_tool {{source}} {{output}}" | 294 command = "python $_tool {{source}} {{output}}" |
273 description = "COPY_BUNDLE_DATA {{source}} {{output}}" | 295 description = "COPY_BUNDLE_DATA {{source}} {{output}}" |
296 pool = ":bundle_pool($default_toolchain)" | |
274 } | 297 } |
275 tool("compile_xcassets") { | 298 tool("compile_xcassets") { |
276 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", | 299 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", |
277 root_build_dir) | 300 root_build_dir) |
278 if (is_ios) { | 301 if (is_ios) { |
279 _sdk_name = ios_sdk_name | 302 _sdk_name = ios_sdk_name |
280 _min_deployment_target = ios_deployment_target | 303 _min_deployment_target = ios_deployment_target |
281 } else { | 304 } else { |
282 _sdk_name = mac_sdk_name | 305 _sdk_name = mac_sdk_name |
283 _min_deployment_target = mac_deployment_target | 306 _min_deployment_target = mac_deployment_target |
284 } | 307 } |
285 command = "rm -f {{output}} && " + | 308 command = "rm -f {{output}} && " + |
286 "python $_tool -p $_sdk_name -t $_min_deployment_target " + | 309 "python $_tool -p $_sdk_name -t $_min_deployment_target " + |
287 "-o {{output}} {{inputs}}" | 310 "-o {{output}} {{inputs}}" |
288 | 311 |
289 description = "COMPILE_XCASSETS {{output}}" | 312 description = "COMPILE_XCASSETS {{output}}" |
313 pool = ":bundle_pool($default_toolchain)" | |
290 } | 314 } |
291 | 315 |
292 toolchain_args() { | 316 toolchain_args() { |
293 current_cpu = invoker.toolchain_cpu | 317 current_cpu = invoker.toolchain_cpu |
294 current_os = invoker.toolchain_os | 318 current_os = invoker.toolchain_os |
295 | 319 |
296 # These values need to be passed through unchanged. | 320 # These values need to be passed through unchanged. |
297 host_toolchain = host_toolchain | 321 host_toolchain = host_toolchain |
298 target_os = target_os | 322 target_os = target_os |
299 target_cpu = target_cpu | 323 target_cpu = target_cpu |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 } | 403 } |
380 | 404 |
381 mac_toolchain("x64") { | 405 mac_toolchain("x64") { |
382 toolchain_cpu = "x64" | 406 toolchain_cpu = "x64" |
383 toolchain_os = "mac" | 407 toolchain_os = "mac" |
384 cc = "${goma_prefix}/gcc" | 408 cc = "${goma_prefix}/gcc" |
385 cxx = "${goma_prefix}/g++" | 409 cxx = "${goma_prefix}/g++" |
386 ld = cxx | 410 ld = cxx |
387 is_clang = false | 411 is_clang = false |
388 } | 412 } |
OLD | NEW |