Skip to content

Commit

Permalink
Add Apple visionOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinPerez committed Apr 10, 2024
1 parent 15050b9 commit d5dc111
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
strategy:
fail-fast: false
matrix:
target: ["aarch64-apple-ios", "aarch64-apple-tvos", "aarch64-unknown-openbsd", "arm64_32-apple-watchos", "armv7-sony-vita-newlibeabihf", "sparcv9-sun-solaris", "x86_64-pc-solaris", "x86_64-unknown-dragonfly", "x86_64-unknown-openbsd"]
target: ["aarch64-apple-ios", "aarch64-apple-visionos", "aarch64-apple-tvos", "aarch64-unknown-openbsd", "arm64_32-apple-watchos", "armv7-sony-vita-newlibeabihf", "sparcv9-sun-solaris", "x86_64-pc-solaris", "x86_64-unknown-dragonfly", "x86_64-unknown-openbsd"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Targets available via Rustup that are supported.
TARGETS ?= aarch64-apple-darwin aarch64-apple-ios aarch64-linux-android arm-linux-androideabi i686-unknown-linux-gnu wasm32-wasi x86_64-apple-darwin x86_64-apple-ios x86_64-pc-windows-gnu x86_64-pc-windows-msvc x86_64-unknown-freebsd x86_64-unknown-illumos x86_64-unknown-linux-gnu x86_64-unknown-linux-musl x86_64-unknown-netbsd x86_64-unknown-redox
TARGETS ?= aarch64-apple-darwin aarch64-apple-ios aarch64-apple-visionos aarch64-linux-android arm-linux-androideabi i686-unknown-linux-gnu wasm32-wasi x86_64-apple-darwin x86_64-apple-ios x86_64-pc-windows-gnu x86_64-pc-windows-msvc x86_64-unknown-freebsd x86_64-unknown-illumos x86_64-unknown-linux-gnu x86_64-unknown-linux-musl x86_64-unknown-netbsd x86_64-unknown-redox
# Example value: `nightly-x86_64-apple-darwin`.
RUSTUP_TOOLCHAIN ?= $(shell rustup show active-toolchain | cut -d' ' -f1)
# Architecture target. Example value: `x86_64-apple-darwin`.
Expand Down
2 changes: 2 additions & 0 deletions src/interest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl Interest {
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -161,6 +162,7 @@ impl fmt::Debug for Interest {
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down
4 changes: 4 additions & 0 deletions src/sys/unix/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub(crate) fn new_socket(domain: libc::c_int, socket_type: libc::c_int) -> io::R
// Mimick `libstd` and set `SO_NOSIGPIPE` on apple systems.
#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -51,6 +52,7 @@ pub(crate) fn new_socket(domain: libc::c_int, socket_type: libc::c_int) -> io::R
// Darwin (and others) doesn't have SOCK_NONBLOCK or SOCK_CLOEXEC.
#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -112,6 +114,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
Expand Down Expand Up @@ -145,6 +148,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
Expand Down
2 changes: 2 additions & 0 deletions src/sys/unix/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub(crate) fn new_raw() -> io::Result<[RawFd; 2]> {
#[cfg(any(
target_os = "aix",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -62,6 +63,7 @@ pub(crate) fn new_raw() -> io::Result<[RawFd; 2]> {
target_os = "freebsd",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down
Loading

0 comments on commit d5dc111

Please sign in to comment.