| 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/nacl/config.gni") | 5 import("//build/config/nacl/config.gni") |
| 6 import("//build/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
| 7 import("//build/toolchain/ccache.gni") |
| 8 import("//build/toolchain/goma.gni") |
| 7 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
| 8 | 10 |
| 9 # This value will be inherited in the toolchain below. | 11 # This value will be inherited in the toolchain below. |
| 10 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 12 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
| 11 | 13 |
| 12 # This template defines a toolchain for something that works like gcc | 14 # This template defines a toolchain for something that works like gcc |
| 13 # (including clang). | 15 # (including clang). |
| 14 # | 16 # |
| 15 # It requires the following variables specifying the executables to run: | 17 # It requires the following variables specifying the executables to run: |
| 16 # - cc | 18 # - cc |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 # When set to true, is_asan, is_msan, etc.will all be set to false. Often | 68 # When set to true, is_asan, is_msan, etc.will all be set to false. Often |
| 67 # secondary toolchains do not want to run with sanitizers. | 69 # secondary toolchains do not want to run with sanitizers. |
| 68 # - is_clang | 70 # - is_clang |
| 69 # Whether to use clang instead of gcc. | 71 # Whether to use clang instead of gcc. |
| 70 # - is_component_build | 72 # - is_component_build |
| 71 # Whether to forcibly enable or disable component builds for this | 73 # Whether to forcibly enable or disable component builds for this |
| 72 # toolchain; if not specified, the toolchain will inherit the | 74 # toolchain; if not specified, the toolchain will inherit the |
| 73 # default setting. | 75 # default setting. |
| 74 # - is_nacl_glibc | 76 # - is_nacl_glibc |
| 75 # Whether NaCl code is built using Glibc instead of Newlib. | 77 # Whether NaCl code is built using Glibc instead of Newlib. |
| 78 # - use_ccache |
| 79 # Override the global use_ccache setting, useful to opt-out of ccache in |
| 80 # a particular toolchain by setting use_ccache = false in it. |
| 81 # - use_goma |
| 82 # Override the global use_goma setting, useful to opt-out of goma in a |
| 83 # particular toolchain by setting use_gome = false in it. |
| 76 template("gcc_toolchain") { | 84 template("gcc_toolchain") { |
| 77 toolchain(target_name) { | 85 toolchain(target_name) { |
| 78 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 86 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
| 79 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 87 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
| 80 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 88 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
| 81 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 89 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
| 82 assert(defined(invoker.toolchain_cpu), | 90 assert(defined(invoker.toolchain_cpu), |
| 83 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 91 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
| 84 assert(defined(invoker.toolchain_os), | 92 assert(defined(invoker.toolchain_os), |
| 85 "gcc_toolchain() must specify a \"toolchain_os\"") | 93 "gcc_toolchain() must specify a \"toolchain_os\"") |
| 86 | 94 |
| 95 if (defined(invoker.use_ccache)) { |
| 96 use_ccache = invoker.use_ccache |
| 97 } |
| 98 if (defined(invoker.use_goma)) { |
| 99 use_goma = invoker.use_goma |
| 100 } |
| 101 if (use_goma) { |
| 102 assert(!use_ccache, "Goma and ccache can't be used together.") |
| 103 compiler_prefix = "$goma_dir/gomacc " |
| 104 } else if (use_ccache) { |
| 105 compiler_prefix = "ccache " |
| 106 } else { |
| 107 compiler_prefix = "" |
| 108 } |
| 109 |
| 87 # This define changes when the toolchain changes, forcing a rebuild. | 110 # This define changes when the toolchain changes, forcing a rebuild. |
| 88 # Nothing should ever use this define. | 111 # Nothing should ever use this define. |
| 89 if (defined(invoker.rebuild_define)) { | 112 if (defined(invoker.rebuild_define)) { |
| 90 rebuild_string = "-D" + invoker.rebuild_define + " " | 113 rebuild_string = "-D" + invoker.rebuild_define + " " |
| 91 } else { | 114 } else { |
| 92 rebuild_string = "" | 115 rebuild_string = "" |
| 93 } | 116 } |
| 94 | 117 |
| 95 # We can't do string interpolation ($ in strings) on things with dots in | 118 cc = compiler_prefix + invoker.cc |
| 96 # them. To allow us to use $cc below, for example, we create copies of | 119 cxx = compiler_prefix + invoker.cxx |
| 97 # these values in our scope. | |
| 98 cc = invoker.cc | |
| 99 cxx = invoker.cxx | |
| 100 ar = invoker.ar | 120 ar = invoker.ar |
| 101 ld = invoker.ld | 121 ld = invoker.ld |
| 102 if (defined(invoker.readelf)) { | 122 if (defined(invoker.readelf)) { |
| 103 readelf = invoker.readelf | 123 readelf = invoker.readelf |
| 104 } else { | 124 } else { |
| 105 readelf = "readelf" | 125 readelf = "readelf" |
| 106 } | 126 } |
| 107 if (defined(invoker.nm)) { | 127 if (defined(invoker.nm)) { |
| 108 nm = invoker.nm | 128 nm = invoker.nm |
| 109 } else { | 129 } else { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 is_lsan = false | 352 is_lsan = false |
| 333 is_msan = false | 353 is_msan = false |
| 334 is_syzyasan = false | 354 is_syzyasan = false |
| 335 is_tsan = false | 355 is_tsan = false |
| 336 } | 356 } |
| 337 } | 357 } |
| 338 | 358 |
| 339 forward_variables_from(invoker, [ "deps" ]) | 359 forward_variables_from(invoker, [ "deps" ]) |
| 340 } | 360 } |
| 341 } | 361 } |
| OLD | NEW |