From 0361abf39d1504966799b1cdb5450e07f88b2bc2 Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Wed, 30 Mar 2022 15:07:56 -0400 Subject: [PATCH] Fix setup for iOS simulator on arm64 Macs. The current setup for the iOS simulator keys off of the fact that iOS runs on ARM CPUs, and Macs (prior to M1) ran on x64 CPUs. So setting the target_os to "ios" and the target_cpu to "x64" will indicate use of the simulator. On M1, they have the same CPU architecture, so we need another method to indicate use of the simulator SDK. Also added a check to disable code signing, which is not needed for running on the simulator. Bug: skia:12880 Change-Id: I668121010cc557546c4a4e4960601a732bb985c5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526017 Reviewed-by: Ben Wagner Commit-Queue: Jim Van Verth --- gn/BUILDCONFIG.gn | 2 ++ gn/ios.gni | 2 +- gn/skia/BUILD.gn | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn index 8d7a76b040..08da7f2bbf 100644 --- a/gn/BUILDCONFIG.gn +++ b/gn/BUILDCONFIG.gn @@ -31,6 +31,8 @@ declare_args() { clang_win_version = "" ios_min_target = "" + ios_use_simulator = + target_os == "ios" && (target_cpu == "x86" || target_cpu == "x64") } declare_args() { is_debug = !is_official_build diff --git a/gn/ios.gni b/gn/ios.gni index 9434472e29..3bce517ce8 100644 --- a/gn/ios.gni +++ b/gn/ios.gni @@ -214,7 +214,7 @@ if (is_ios) { } # should only code sign when running on a device, not the simulator - if (target_cpu != "x64") { + if (!ios_use_simulator) { code_signing_script = "//gn/codesign_ios.py" code_signing_sources = [ "$target_gen_dir/$app_name" ] code_signing_outputs = [ diff --git a/gn/skia/BUILD.gn b/gn/skia/BUILD.gn index 633bb7c971..9f2df2f8ec 100644 --- a/gn/skia/BUILD.gn +++ b/gn/skia/BUILD.gn @@ -25,12 +25,12 @@ declare_args() { if (is_ios && xcode_sysroot == "") { if (is_tvos) { sdk = "appletvos" - if (target_cpu == "x86" || target_cpu == "x64") { + if (ios_use_simulator) { sdk = "appletvsimulator" } } else { sdk = "iphoneos" - if (target_cpu == "x86" || target_cpu == "x64") { + if (ios_use_simulator) { sdk = "iphonesimulator" } }