Skip to content

Commit

Permalink
apple-sdk: add XROS sdk support
Browse files Browse the repository at this point in the history
Closes #134.
  • Loading branch information
danpashin authored and indygreg committed Feb 4, 2024
1 parent 703362f commit 634c741
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apple-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

Released on ReleaseDate.

* XROS support. `Platform` enumeration added `XrOs` and `XrOsSimulator`
variants. The `aarch64-apple-xros-sim` and `*-apple-xros` triples are
now recognized as XROS.

## 0.5.2

Released on 2023-12-22.
Expand Down
10 changes: 10 additions & 0 deletions apple-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ pub enum Platform {
MacOsX,
WatchOs,
WatchSimulator,
XrOs,
XrOsSimulator,
Unknown(String),
}

Expand All @@ -254,6 +256,8 @@ impl FromStr for Platform {
"macosx" => Ok(Self::MacOsX),
"watchos" => Ok(Self::WatchOs),
"watchsimulator" => Ok(Self::WatchSimulator),
"xros" => Ok(Self::XrOs),
"xrsimulator" => Ok(Self::XrOsSimulator),
v => Ok(Self::Unknown(v.to_string())),
}
}
Expand Down Expand Up @@ -318,6 +322,8 @@ impl Platform {
target if target.ends_with("-apple-watchos") => Platform::WatchOs,
"x86_64-apple-tvos" => Self::AppleTvSimulator,
target if target.ends_with("-apple-tvos") => Platform::AppleTvOs,
"aarch64-apple-xros-sim" => Platform::XrOsSimulator,
target if target.ends_with("-apple-xros") => Platform::XrOs,
_ => return Err(Error::UnknownTarget(target.to_string())),
};
Ok(platform)
Expand All @@ -339,6 +345,8 @@ impl Platform {
Self::MacOsX => "MacOSX",
Self::WatchOs => "WatchOS",
Self::WatchSimulator => "WatchSimulator",
Self::XrOs => "XROS",
Self::XrOsSimulator => "XRSimulator",
Self::Unknown(v) => v,
}
}
Expand Down Expand Up @@ -1081,6 +1089,8 @@ mod test {
test("x86_64-apple-ios-macabi", IPhoneOs);
test("x86_64-apple-tvos", AppleTvSimulator);
test("x86_64-apple-watchos-sim", WatchSimulator);
test("aarch64-apple-xros", XrOs);
test("aarch64-apple-xros-sim", XrOsSimulator);

assert!(Platform::from_target_triple("x86_64-unknown-linux-gnu").is_err());

Expand Down

0 comments on commit 634c741

Please sign in to comment.