Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,11 @@ if (custom_toolchain != "") {
import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator
host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
if (use_ios_simulator) {
set_default_toolchain("//build/toolchain/mac:ios_clang_x64")
if (target_cpu == "arm" || target_cpu == "arm64") {
set_default_toolchain("//build/toolchain/mac:ios_clang_arm_sim")
} else {
set_default_toolchain("//build/toolchain/mac:ios_clang_x64_sim")
}
} else {
set_default_toolchain("//build/toolchain/mac:ios_clang_arm")
}
Expand Down
6 changes: 5 additions & 1 deletion build/toolchain/clang.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# 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") # For use_ios_simulator

declare_args() {
# Enable the optional type profiler in Clang, which will tag heap allocations
# with the allocation type.
Expand All @@ -26,5 +28,7 @@ declare_args() {
# TODO(dnfield): We shouldn't need Xcode for bitcode_marker builds, but we do
# until libpng and dart have explicitly added LLVM asm sections to their
# assembly sources. https://github.com/flutter/flutter/issues/39281
use_xcode = enable_bitcode
# TODO(gw280): Once our own copy of clang 12 is capable of building for arm64 simulator,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once our own copy of clang 12 is capable

I like the optimism

# we can safely remove the requirement that we use xcode for arm64 simulator builds.
use_xcode = enable_bitcode || (use_ios_simulator && (target_cpu == "arm" || target_cpu == "arm64"))
}
25 changes: 23 additions & 2 deletions build/toolchain/mac/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,29 @@ mac_toolchain("ios_clang_arm") {
sysroot_flags = "-isysroot $ios_device_sdk_path -miphoneos-version-min=$ios_deployment_target"
}

# Toolchain used for iOS simulator targets.
mac_toolchain("ios_clang_x64") {
# Toolchain used for iOS simulator targets (arm64).
mac_toolchain("ios_clang_arm_sim") {
toolchain_cpu = "arm"
toolchain_os = "mac"
if (!use_xcode) {
prefix = rebase_path(llvm_bin_path, root_build_dir)
ar = "$prefix/llvm-ar"
cc = "$prefix/clang"
cxx = "$prefix/clang++"
} else {
# TODO: https://github.com/harfbuzz/harfbuzz/issues/2834
# harfbuzz has a non-fatal warning right now with Xcode 12
ar = "ar"
cc = "clang"
cxx = "clang++"
}
ld = cxx
is_clang = true
sysroot_flags = "-isysroot $ios_simulator_sdk_path -mios-simulator-version-min=$ios_deployment_target"
}

# Toolchain used for iOS simulator targets (x64).
mac_toolchain("ios_clang_x64_sim") {
toolchain_cpu = "x64"
toolchain_os = "mac"
prefix = rebase_path(llvm_bin_path, root_build_dir)
Expand Down