From 8d98b5cb4b9d5f4b470d01ec5b49a40f1d1cae93 Mon Sep 17 00:00:00 2001 From: Luis Cruz Date: Mon, 10 Jul 2023 16:41:49 +0100 Subject: [PATCH 1/2] fix: Add apple tvos support --- src/lib.rs | 12 ++++++++++++ tests/support/mod.rs | 6 ++++++ tests/test.rs | 8 ++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 77f1a1db..2ac24a43 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1840,6 +1840,16 @@ 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(), @@ -2577,6 +2587,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") { diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 3ec19111..94b51f65 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -61,6 +61,12 @@ impl Test { t } + pub fn clang() -> 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() diff --git a/tests/test.rs b/tests/test.rs index f712c436..fc07e625 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -510,9 +510,9 @@ fn gnu_apple_darwin() { #[cfg(target_os = "macos")] #[test] -fn apple_tvos() { +fn clang_apple_tvos() { for target in &["aarch64-apple-tvos"] { - let test = Test::gnu(); + let test = Test::clang(); test.gcc() .target(&target) .host(&target) @@ -525,9 +525,9 @@ fn apple_tvos() { #[cfg(target_os = "macos")] #[test] -fn apple_tvsimulator() { +fn clang_apple_tvsimulator() { for target in &["x86_64-apple-tvos"] { - let test = Test::gnu(); + let test = Test::clang(); test.gcc() .target(&target) .host(&target) From a92bedfa490c07f83e06d328cdc395501415882d Mon Sep 17 00:00:00 2001 From: Luis Cruz Date: Tue, 10 Oct 2023 14:08:11 +0100 Subject: [PATCH 2/2] ci: Add apple tvOS build job --- .github/workflows/main.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f228695..1fafe834 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,6 +92,24 @@ jobs: - run: cargo test ${{ matrix.no_run }} --manifest-path cc-test/Cargo.toml --target ${{ matrix.target }} --features parallel - run: cargo test ${{ matrix.no_run }} --manifest-path cc-test/Cargo.toml --target ${{ matrix.target }} --release + check-tvos: + name: Test aarch64-apple-tvos + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust (rustup) + run: | + set -euxo pipefail + rustup toolchain install nightly --no-self-update --profile minimal + rustup component add rust-src --toolchain nightly + rustup default nightly + shell: bash + - run: cargo test -Z build-std=std --no-run --target aarch64-apple-tvos + - run: cargo test -Z build-std=std --no-run --features parallel --target aarch64-apple-tvos + - run: cargo test -Z build-std=std --no-run --manifest-path cc-test/Cargo.toml --target aarch64-apple-tvos + - run: cargo test -Z build-std=std --no-run --manifest-path cc-test/Cargo.toml --target aarch64-apple-tvos --features parallel + - run: cargo test -Z build-std=std --no-run --manifest-path cc-test/Cargo.toml --target aarch64-apple-tvos --release + cuda: name: Test CUDA support runs-on: ubuntu-20.04