| # Copyright 2016 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Modifications Copyright 2017 The Cobalt Authors. All Rights Reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # This file should only be imported from files that define toolchains. |
| # There's no way to enforce this exactly, but all toolchains are processed |
| # in the context of the default_toolchain, so we can at least check for that. |
| assert(current_toolchain == default_toolchain) |
| |
| declare_args() { |
| # Limit the number of concurrent links; we often want to run fewer |
| # links at once than we do compiles, because linking is memory-intensive. |
| # The default to use varies by platform and by the amount of memory |
| # available, so we call out to a script to get the right value. |
| concurrent_links = -1 |
| } |
| |
| if (concurrent_links == -1) { |
| if (host_os == "win") { |
| _args = [ "--mem_per_link_gb=5" ] |
| } else if (host_os == "mac") { |
| _args = [ "--mem_per_link_gb=4" ] |
| } |
| else { |
| _args = [] |
| } |
| |
| # TODO(crbug.com/617429) Pass more build configuration info to the script |
| # so that we can compute better values. |
| concurrent_links = exec_script("get_concurrent_links.py", _args, "value") |
| } |