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

feat: Added visionOS support for Apple Vision Pro #1286

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changes/visionos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Added visionOS support based on https://github.com/rust-lang/rust/pull/121419
28 changes: 19 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,25 @@ jobs:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: aarch64-apple-ios, os: macos-latest }
- { target: aarch64-apple-visionos, os: macos-latest }
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: aarch64-linux-android, os: ubuntu-latest }

runs-on: ${{ matrix.platform.os }}

steps:
# - uses: actions/checkout@v4
# - name: install stable
# uses: dtolnay/rust-toolchain@stable
# with:
# targets: ${{ matrix.platform.target }}
- uses: actions/checkout@v4
- name: install stable
uses: dtolnay/rust-toolchain@stable
- name: install nightly
uses: dtolnay/rust-toolchain@nightly
with:
profile: minimal
targets: ${{ matrix.platform.target }}
# components: rust-src, miri

- name: install webkit2gtk (ubuntu only)
if: contains(matrix.platform.target, 'gnu')
Expand All @@ -44,7 +52,7 @@ jobs:
- uses: Swatinem/rust-cache@v2

- name: build wry
run: cargo build --target ${{ matrix.platform.target }} --all-features
run: cargo +nightly build -Z build-std=std,panic_abort --target ${{ matrix.platform.target }} --all-features

- name: build tests and examples
shell: bash
Expand All @@ -55,15 +63,17 @@ jobs:
if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
run: cargo test --verbose --target ${{ matrix.platform.target }} --features linux-body

- name: install nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.platform.target }}
components: miri
# - name: install nightly
# uses: dtolnay/rust-toolchain@nightly
# with:
# targets: ${{ matrix.platform.target }}
# components: miri

- name: Run tests with miri
if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
run: cargo +nightly miri test --verbose --target ${{ matrix.platform.target }} --features linux-body
run: |
rustup +nightly component add miri
cargo +nightly -Z build-std=std,panic_abort miri test --verbose --target ${{ matrix.platform.target }} --features linux-body

doc:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dunce = "1"
"Win32_UI_Input_KeyboardAndMouse"
]

[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies]
[target."cfg(any(target_os = \"ios\", target_os = \"visionos\", target_os = \"macos\"))".dependencies]
block = "0.1"
cocoa = "0.25"
core-graphics = "0.23"
Expand Down
2 changes: 2 additions & 0 deletions bench/tests/src/cpu_intensive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -36,6 +37,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 2 additions & 0 deletions bench/tests/src/custom_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -60,6 +61,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 2 additions & 0 deletions bench/tests/src/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -51,6 +52,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

fn main() {
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
if target_os == "macos" || target_os == "ios" {
if target_os == "macos" || target_os == "ios" || target_os == "visionos" {
println!("cargo:rustc-link-lib=framework=WebKit");
}

Expand Down
2 changes: 2 additions & 0 deletions examples/async_custom_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -30,6 +31,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 2 additions & 0 deletions examples/custom_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -30,6 +31,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 2 additions & 0 deletions examples/custom_titlebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -253,6 +254,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
3 changes: 3 additions & 0 deletions examples/gtk_multiwebview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let fixed = {
Expand All @@ -38,6 +39,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
return WebViewBuilder::new_as_child(&window);
Expand All @@ -46,6 +48,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
{
Expand Down
2 changes: 2 additions & 0 deletions examples/multiwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ fn create_new_window(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -104,6 +105,7 @@ fn create_new_window(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
5 changes: 5 additions & 0 deletions examples/reparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ use {tao::platform::windows::WindowExtWindows, wry::WebViewExtWindows};
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
use {
Expand All @@ -41,6 +43,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -49,6 +52,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down Expand Up @@ -97,6 +101,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
webview
Expand Down
2 changes: 2 additions & 0 deletions examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -25,6 +26,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 2 additions & 0 deletions examples/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -35,6 +36,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
2 changes: 2 additions & 0 deletions examples/transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
Expand All @@ -42,6 +43,7 @@ fn main() -> wry::Result<()> {
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "visionos",
target_os = "android"
)))]
let builder = {
Expand Down
Loading
Loading