BUILD.gn (2936B)
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 5 import("//chromium/build/config/mac/mac_sdk.gni") 6 import("//chromium/build/config/v8_target_cpu.gni") 7 import("//chromium/build/toolchain/apple/toolchain.gni") 8 import("//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. 12 template("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/40534102): 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 # iOS supports being build with or without blink, but macOS requires 48 # it to be enabled, even if iOS build force disable it in args.gn. 49 use_blink = true 50 } 51 } 52 } 53 } 54 55 mac_toolchain("clang_arm") { 56 toolchain_args = { 57 target_cpu = "arm" 58 } 59 } 60 61 mac_toolchain("clang_arm64") { 62 toolchain_args = { 63 target_cpu = "arm64" 64 } 65 } 66 67 mac_toolchain("clang_x64") { 68 toolchain_args = { 69 target_cpu = "x64" 70 } 71 } 72 73 mac_toolchain("clang_x86") { 74 toolchain_args = { 75 target_cpu = "x86" 76 } 77 } 78 79 mac_toolchain("clang_x86_v8_arm") { 80 toolchain_args = { 81 target_cpu = "x86" 82 v8_target_cpu = "arm" 83 } 84 } 85 86 mac_toolchain("clang_x86_v8_mipsel") { 87 toolchain_args = { 88 target_cpu = "x86" 89 v8_target_cpu = "mipsel" 90 } 91 } 92 93 mac_toolchain("clang_x64_v8_arm64") { 94 toolchain_args = { 95 target_cpu = "x64" 96 v8_target_cpu = "arm64" 97 } 98 } 99 100 mac_toolchain("clang_x64_v8_mips64el") { 101 toolchain_args = { 102 target_cpu = "x64" 103 v8_target_cpu = "mips64el" 104 } 105 } 106 107 mac_toolchain("clang_arm64_v8_x64") { 108 toolchain_args = { 109 target_cpu = "arm64" 110 v8_target_cpu = "x64" 111 } 112 } 113 114 # Needed to run v8 on the host during a arm64 -> x86_64 cross-build 115 mac_toolchain("clang_arm64_v8_arm64") { 116 toolchain_args = { 117 target_cpu = "arm64" 118 v8_target_cpu = "arm64" 119 } 120 }