Skip to content

Commit

Permalink
Address issues with new Catalyst/M1 simulator targets (#614)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
eranrund authored Aug 30, 2021
1 parent 05a8062 commit 178fd03
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down

0 comments on commit 178fd03

Please sign in to comment.