Skip to content

Commit 10654d4

Browse files
committed
Add visionos target
1 parent 2ddffdb commit 10654d4

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/ferric/src/cargo.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
AppleTargetName,
1717
isAndroidTarget,
1818
isAppleTarget,
19+
isThirdTierTarget,
1920
} from "./targets.js";
2021

2122
const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record<AppleTargetName, string> = {
@@ -26,12 +27,15 @@ const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record<AppleTargetName, string> = {
2627
"aarch64-apple-ios-sim": "ios-arm64_x86_64-simulator", // Universal
2728
"x86_64-apple-ios": "ios-arm64_x86_64-simulator", // Universal
2829

30+
"aarch64-apple-visionos": "xros-arm64",
31+
"aarch64-apple-visionos-sim": "xros-arm64_x86_64-simulator", // Universal
32+
// The x86_64 target for vision simulator isn't supported
33+
// see https://doc.rust-lang.org/rustc/platform-support.html
34+
2935
// "aarch64-apple-ios-macabi": "", // Catalyst
3036
// "x86_64-apple-ios-macabi": "ios-x86_64-simulator",
3137
// "aarch64-apple-tvos": "tvos-arm64",
3238
// "aarch64-apple-tvos-sim": "tvos-arm64-simulator",
33-
// "aarch64-apple-visionos": "xros-arm64",
34-
// "aarch64-apple-visionos-sim": "xros-arm64-simulator",
3539
};
3640

3741
const ANDROID_ARCH_PR_TARGET: Record<AndroidTargetName, string> = {
@@ -84,6 +88,14 @@ export async function build(options: BuildOptions) {
8488
if (configuration.toLowerCase() === "release") {
8589
args.push("--release");
8690
}
91+
if (isThirdTierTarget(target)) {
92+
// Use the nightly toolchain for third tier targets
93+
args.splice(0, 0, "+nightly");
94+
// Passing the nightly "build-std" to
95+
// > Enable Cargo to compile the standard library itself as part of a crate graph compilation
96+
// See https://doc.rust-lang.org/rustc/platform-support/apple-visionos.html#building-the-target
97+
args.push("-Z", "build-std=std,panic_abort");
98+
}
8799
await spawn("cargo", args, {
88100
outputMode: "buffered",
89101
env: {

0 commit comments

Comments
 (0)