Skip to content

Commit 8d98b5c

Browse files
committed
fix: Add apple tvos support
1 parent bd25128 commit 8d98b5c

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,16 @@ impl Build {
18401840
.into(),
18411841
);
18421842
}
1843+
} else if target.contains("aarch64-apple-tvos") {
1844+
if let Some(arch) =
1845+
map_darwin_target_from_rust_to_compiler_architecture(target)
1846+
{
1847+
let deployment_target =
1848+
self.apple_deployment_version(AppleOs::TvOs, target, None);
1849+
cmd.args.push(
1850+
format!("--target={}-apple-tvos{}", arch, deployment_target).into(),
1851+
);
1852+
}
18431853
} else if target.starts_with("riscv64gc-") {
18441854
cmd.args.push(
18451855
format!("--target={}", target.replace("riscv64gc", "riscv64")).into(),
@@ -2577,6 +2587,8 @@ impl Build {
25772587
clang.to_string()
25782588
} else if target.contains("apple-watchos") {
25792589
clang.to_string()
2590+
} else if target.contains("apple-tvos") {
2591+
clang.to_string()
25802592
} else if target.contains("android") {
25812593
autodetect_android_compiler(&target, &host, gnu, clang)
25822594
} else if target.contains("cloudabi") {

tests/support/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ impl Test {
6161
t
6262
}
6363

64+
pub fn clang() -> Test {
65+
let t = Test::new();
66+
t.shim("clang").shim("clang++").shim("ar");
67+
t
68+
}
69+
6470
pub fn shim(&self, name: &str) -> &Test {
6571
let name = if name.ends_with(env::consts::EXE_SUFFIX) {
6672
name.to_string()

tests/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ fn gnu_apple_darwin() {
510510

511511
#[cfg(target_os = "macos")]
512512
#[test]
513-
fn apple_tvos() {
513+
fn clang_apple_tvos() {
514514
for target in &["aarch64-apple-tvos"] {
515-
let test = Test::gnu();
515+
let test = Test::clang();
516516
test.gcc()
517517
.target(&target)
518518
.host(&target)
@@ -525,9 +525,9 @@ fn apple_tvos() {
525525

526526
#[cfg(target_os = "macos")]
527527
#[test]
528-
fn apple_tvsimulator() {
528+
fn clang_apple_tvsimulator() {
529529
for target in &["x86_64-apple-tvos"] {
530-
let test = Test::gnu();
530+
let test = Test::clang();
531531
test.gcc()
532532
.target(&target)
533533
.host(&target)

0 commit comments

Comments
 (0)