From 178fd031e74f643721605e25110ee6abce8dbe05 Mon Sep 17 00:00:00 2001 From: Eran Rundstein Date: Mon, 30 Aug 2021 13:37:00 -0700 Subject: [PATCH] Address issues with new Catalyst/M1 simulator targets (#614) * Fix build for the new M1 aarch64-apple-ios-sim target * allow explicit target versioning for catalyst builds * always use ios13.0 target for catalyst builds --- src/lib.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6802d238..2de24571 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1535,9 +1535,8 @@ impl Build { if let Some(arch) = map_darwin_target_from_rust_to_compiler_architecture(target) { - let ios = if arch == "arm64" { "ios" } else { "ios13.0" }; cmd.args - .push(format!("--target={}-apple-{}-macabi", arch, ios).into()); + .push(format!("--target={}-apple-ios13.0-macabi", arch).into()); } } else if target.contains("ios-sim") { if let Some(arch) = @@ -1999,6 +1998,11 @@ impl Build { None => false, }; + let is_sim = match target.split('-').nth(3) { + Some(v) => v == "sim", + None => false, + }; + let arch = if is_catalyst { match arch { "arm64e" => ArchSpec::Catalyst("arm64e"), @@ -2011,6 +2015,16 @@ impl Build { )); } } + } else if is_sim { + match arch { + "arm64" | "aarch64" => ArchSpec::Simulator("-arch arm64"), + _ => { + return Err(Error::new( + ErrorKind::ArchitectureInvalid, + "Unknown architecture for iOS simulator target.", + )); + } + } } else { match arch { "arm" | "armv7" | "thumbv7" => ArchSpec::Device("armv7"),