| # Copyright 2021 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/ios/ios_sdk.gni") |
| import("//build/toolchain/apple/toolchain.gni") |
| |
| # Specialisation of the apple_toolchain template to declare a single toolchain |
| # and its tools to build target for iOS platform. |
| template("ios_single_toolchain") { |
| assert(defined(invoker.toolchain_args), |
| "Toolchains must declare toolchain_args") |
| |
| apple_toolchain(target_name) { |
| forward_variables_from(invoker, "*", [ "toolchain_args" ]) |
| |
| sdk_developer_dir = ios_sdk_developer_dir |
| deployment_target = ios_deployment_target |
| target_environment = target_environment |
| bin_path = ios_bin_path |
| |
| toolchain_args = { |
| forward_variables_from(invoker.toolchain_args, "*") |
| xcode_build = xcode_build |
| current_os = "ios" |
| |
| # TODO(crbug.com/408032145): Add ptrauth support to lld, remove this. |
| if (current_cpu == "arm64e") { |
| use_lld = false |
| } |
| |
| # Disable partition alloc for app extensions except for blink. |
| if (ios_is_app_extension && !use_blink) { |
| # As use_partition_alloc is defined outside of //build, check that |
| # the build is part of chromium before overriding the variable. |
| if (build_with_chromium) { |
| use_partition_alloc = false |
| } |
| } |
| } |
| } |
| } |
| |
| # Template to declare all the toolchains for a given architecture for iOS. |
| template("ios_all_toolchains") { |
| assert(defined(invoker.toolchain_args), |
| "Toolchains must declare toolchain_args") |
| |
| ios_single_toolchain(target_name) { |
| forward_variables_from(invoker, "*", [ "toolchain_args" ]) |
| toolchain_args = { |
| forward_variables_from(invoker.toolchain_args, "*") |
| } |
| } |
| |
| ios_single_toolchain(target_name + "_app_ext") { |
| forward_variables_from(invoker, "*", [ "toolchain_args" ]) |
| toolchain_args = { |
| forward_variables_from(invoker.toolchain_args, "*") |
| ios_is_app_extension = true |
| } |
| } |
| } |
| |
| ios_all_toolchains("ios_clang_arm64") { |
| toolchain_args = { |
| current_cpu = "arm64" |
| } |
| } |
| |
| ios_all_toolchains("ios_clang_arm64e") { |
| toolchain_args = { |
| current_cpu = "arm64e" |
| } |
| } |
| |
| ios_all_toolchains("ios_clang_x64") { |
| toolchain_args = { |
| current_cpu = "x64" |
| } |
| } |