xref: /aosp_15_r20/external/angle/build/toolchain/nacl_toolchain.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# Copyright (c) 2014 The Native Client Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/nacl/config.gni")
6import("//build/toolchain/gcc_toolchain.gni")
7
8# This template defines a NaCl toolchain.
9#
10# It requires the following variables specifying the executables to run:
11#  - cc
12#  - cxx
13#  - ar
14#  - ld
15
16template("nacl_toolchain") {
17  assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value")
18  assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value")
19  assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value")
20  assert(defined(invoker.ld), "nacl_toolchain() must specify a \"ld\" value")
21  gcc_toolchain(target_name) {
22    if (defined(invoker.executable_extension)) {
23      executable_extension = invoker.executable_extension
24    } else {
25      executable_extension = ".nexe"
26    }
27    rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision
28
29    forward_variables_from(invoker,
30                           [
31                             "ar",
32                             "cc",
33                             "cxx",
34                             "deps",
35                             "ld",
36                             "link_outputs",
37                             "nm",
38                             "readelf",
39                             "strip",
40                             "extra_cppflags",
41                           ])
42
43    toolchain_args = {
44      # Use all values set on the invoker's toolchain_args.
45      forward_variables_from(invoker.toolchain_args, "*")
46
47      current_os = "nacl"
48
49      # We do not support component builds with the NaCl toolchains.
50      is_component_build = false
51
52      # We do not support clang profiling in the NaCl toolchains.
53      use_clang_profiling = false
54      use_clang_coverage = false
55      coverage_instrumentation_input_file = ""
56
57      if (use_reclient) {
58        if (is_win) {
59          reclient_cc_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
60                                 "/nacl/rewrapper_windows.cfg"
61        } else if (is_mac) {
62          reclient_cc_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
63                                 "/nacl/rewrapper_mac.cfg"
64        } else {
65          # TODO(ukai): non linux?
66          reclient_cc_cfg_file = rebase_path(reclient_cfg_dir, root_build_dir) +
67                                 "/nacl/rewrapper_linux.cfg"
68        }
69      }
70    }
71  }
72}
73