• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Chromium Authors
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/mac/mac_sdk.gni")
6import("//build/config/v8_target_cpu.gni")
7import("//build/toolchain/apple/toolchain.gni")
8import("//build_overrides/build.gni")
9
10# Specialisation of the apple_toolchain template to declare the toolchain
11# and its tools to build target for macOS platform.
12template("mac_toolchain") {
13  assert(defined(invoker.toolchain_args),
14         "Toolchains must declare toolchain_args")
15
16  apple_toolchain(target_name) {
17    forward_variables_from(invoker, "*", [ "toolchain_args" ])
18
19    bin_path = mac_bin_path
20
21    toolchain_args = {
22      forward_variables_from(invoker.toolchain_args, "*")
23      current_os = "mac"
24
25      if (target_os == "ios") {
26        # Use LLD for the host part of a chrome/ios build.
27        use_lld = true
28
29        # Override `is_component_build` for the host toolchain.
30        # See https://crbug.com/gn/286 for details why this is
31        # required.
32        is_component_build = is_debug
33
34        # Defined in //base, would trigger a warning if the build doesn't depend
35        # on it.
36        if (build_with_chromium) {
37          # cronet disable this because it targets 32-bit,
38          # enable it unconditionally for the host toolchain.
39          use_allocator_shim = true
40        }
41
42        # TODO(crbug.com/753445): the use_sanitizer_coverage arg is currently
43        # not supported by the Chromium mac_clang_x64 toolchain on iOS
44        # distribution.
45        use_sanitizer_coverage = false
46      }
47    }
48  }
49}
50
51mac_toolchain("clang_arm") {
52  toolchain_args = {
53    current_cpu = "arm"
54  }
55}
56
57mac_toolchain("clang_arm64") {
58  toolchain_args = {
59    current_cpu = "arm64"
60  }
61}
62
63mac_toolchain("clang_x64") {
64  toolchain_args = {
65    current_cpu = "x64"
66  }
67}
68
69mac_toolchain("clang_x86") {
70  toolchain_args = {
71    current_cpu = "x86"
72  }
73}
74
75mac_toolchain("clang_x86_v8_arm") {
76  toolchain_args = {
77    current_cpu = "x86"
78    v8_current_cpu = "arm"
79  }
80}
81
82mac_toolchain("clang_x86_v8_mipsel") {
83  toolchain_args = {
84    current_cpu = "x86"
85    v8_current_cpu = "mipsel"
86  }
87}
88
89mac_toolchain("clang_x64_v8_arm64") {
90  toolchain_args = {
91    current_cpu = "x64"
92    v8_current_cpu = "arm64"
93  }
94}
95
96mac_toolchain("clang_x64_v8_mips64el") {
97  toolchain_args = {
98    current_cpu = "x64"
99    v8_current_cpu = "mips64el"
100  }
101}
102
103mac_toolchain("clang_arm64_v8_x64") {
104  toolchain_args = {
105    current_cpu = "arm64"
106    v8_current_cpu = "x64"
107  }
108}
109
110# Needed to run v8 on the host during a arm64 -> x86_64 cross-build
111mac_toolchain("clang_arm64_v8_arm64") {
112  toolchain_args = {
113    current_cpu = "arm64"
114    v8_current_cpu = "arm64"
115  }
116}
117