| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| assert( |
| current_toolchain == default_toolchain, |
| "This should only be imported in the default_toolchain, beause the pools it is used with MUST only be defined once for the entire build.") |
| |
| import("//build/config/lto/config.gni") |
| |
| _script = "get_concurrent_jobs.py" |
| _args = [ |
| "-S", # https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=62771 |
| rebase_path(_script, root_build_dir), |
| "--reserve-memory=1GB", |
| ] |
| |
| if (use_lto) { |
| # As per logic in //build/config/lto/config.gni, only use thinlto |
| # if lto is set |
| if (use_thinlto) { |
| _args += [ |
| "--memory-per-job", |
| "local=16GB", |
| ] |
| } else { |
| _args += [ |
| "--memory-per-job", |
| "local=32GB", |
| ] |
| } |
| } else { |
| # No lto |
| _args += [ |
| "--memory-per-job", |
| "local=1GB", |
| ] |
| } |
| default_concurrent_jobs = |
| exec_script(python_exe_src, _args, "json", [ _script ]) |