Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tvos-sim support #951

Merged
merged 8 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,24 @@ jobs:
- run: cargo test -Z build-std=std --no-run --workspace --target aarch64-apple-tvos --release
- run: cargo test -Z build-std=std --no-run --workspace --target aarch64-apple-tvos --features parallel

# This is separate from the matrix above because there is no prebuilt rust-std component for the target.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a new matrix to combine this with the aarch64-apple-tvos test above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Be-ing I updated to have a matrix for all -Z build-std targets. The only ones right now are tvOS targets but any tier 3 targets would fall in this same bucket as well.

check-tvos-sim:
name: Test aarch64-apple-tvos-sim
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
- uses: Swatinem/rust-cache@v2
- run: cargo test -Z build-std=std --no-run --workspace --target aarch64-apple-tvos-sim
- run: cargo test -Z build-std=std --no-run --workspace --target aarch64-apple-tvos-sim --release
- run: cargo test -Z build-std=std --no-run --workspace --target aarch64-apple-tvos-sim --features parallel

cuda:
name: Test CUDA support
runs-on: ubuntu-20.04
Expand Down
17 changes: 1 addition & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ impl Build {
.into(),
);
}
} else if target.contains("x86_64-apple-tvos") {
} else if target.contains("tvos-sim") || target.contains("x86_64-apple-tvos") {
if let Some(arch) =
map_darwin_target_from_rust_to_compiler_architecture(target)
{
Expand All @@ -1948,21 +1948,6 @@ impl Build {
.into(),
);
}
} else if target.contains("aarch64-apple-tvos") {
if let Some(arch) =
map_darwin_target_from_rust_to_compiler_architecture(target)
{
let sdk_details =
apple_os_sdk_parts(AppleOs::TvOs, &AppleArchSpec::Device(""));
let deployment_target = self.apple_deployment_version(
AppleOs::TvOs,
None,
&sdk_details.sdk,
);
cmd.args.push(
format!("--target={}-apple-tvos{}", arch, deployment_target).into(),
);
Copy link
Contributor

@BlackHoleFox BlackHoleFox Feb 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to misalign with XCode at least. When building Objective-C with clang via XCode it passes the -target flag to convey the deployment target: -target arm64-apple-tvos16.0 instead of the os-version-min flag we pass (which doesn't seem documented for tvOS/watchOS? ignoring that though...)

Did you try building any libs with this just to make sure? I didn't see a problem getting the deployment target into the final Mach-o executable at least.

Copy link
Contributor Author

@ErikEverson ErikEverson Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point. I will add back this code as everything worked fine either way and that will align it with XCode's behavior.
As for libraries that I built this on there are two. Blake3 and Ring. Both are dependencies of the project I am working on Ditto which is included in my iPad/tvOS application/s.

the produced binary Mach-O Platform type was verified with otool.

}
} else if target.starts_with("riscv64gc-") {
cmd.args.push(
format!("--target={}", target.replace("riscv64gc", "riscv64")).into(),
Expand Down