Skip to content

Commit

Permalink
fix: Add apple tvos support
Browse files Browse the repository at this point in the history
  • Loading branch information
lcruz99 committed Nov 9, 2023
1 parent bd25128 commit 2ca1fe0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,20 @@ impl Build {
.into(),
);
}
} else if target.contains("aarch64-apple-tvos") {
if let Some(arch) =
map_darwin_target_from_rust_to_compiler_architecture(target)
{
let deployment_target =
self.apple_deployment_version(AppleOs::TvOs, target, None);
cmd.args.push(
format!(
"--target={}-apple-tvos{}",
arch, deployment_target
)
.into(),
);
}
} else if target.starts_with("riscv64gc-") {
cmd.args.push(
format!("--target={}", target.replace("riscv64gc", "riscv64")).into(),
Expand Down Expand Up @@ -2577,6 +2591,8 @@ impl Build {
clang.to_string()
} else if target.contains("apple-watchos") {
clang.to_string()
} else if target.contains("apple-tvos") {
clang.to_string()
} else if target.contains("android") {
autodetect_android_compiler(&target, &host, gnu, clang)
} else if target.contains("cloudabi") {
Expand Down
6 changes: 6 additions & 0 deletions tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ impl Test {
t
}

pub fn darwin() -> Test {
let t = Test::new();
t.shim("clang").shim("clang++").shim("ar");
t
}

pub fn shim(&self, name: &str) -> &Test {
let name = if name.ends_with(env::consts::EXE_SUFFIX) {
name.to_string()
Expand Down
4 changes: 2 additions & 2 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ fn gnu_apple_darwin() {
#[test]
fn apple_tvos() {
for target in &["aarch64-apple-tvos"] {
let test = Test::gnu();
let test = Test::darwin();
test.gcc()
.target(&target)
.host(&target)
Expand All @@ -527,7 +527,7 @@ fn apple_tvos() {
#[test]
fn apple_tvsimulator() {
for target in &["x86_64-apple-tvos"] {
let test = Test::gnu();
let test = Test::darwin();
test.gcc()
.target(&target)
.host(&target)
Expand Down

0 comments on commit 2ca1fe0

Please sign in to comment.