From fcedb9c0c892915f9fb549f5530c698f39aa2283 Mon Sep 17 00:00:00 2001 From: Schmarni <51007916+Schmarni-Dev@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:09:07 +0100 Subject: [PATCH] do not compile openxrs for wasm32 (#59) --- Cargo.toml | 4 ++-- src/lib.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 57a7a2ad..bd61fc93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,10 +24,10 @@ wgpu = "0.17.1" wgpu-core = { version = "0.17.1", features = ["vulkan"] } wgpu-hal = "0.17.1" -[target.'cfg( target_family = "unix" )'.dependencies] +[target.'cfg(all(target_family = "unix", not(target_arch = "wasm32")) )'.dependencies] openxr = { version = "0.17.1", features = ["mint"] } -[target.'cfg(not(target_family = "unix"))'.dependencies] +[target.'cfg(all(not(target_family = "unix"), not(target_arch = "wasm32")))'.dependencies] openxr = { version = "0.17.1", features = ["mint", "static"] } [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 71427733..3957e5e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,6 +82,8 @@ impl Plugin for OpenXrPlugin { let mut system_state: SystemState>> = SystemState::new(&mut app.world); let primary_window = system_state.get(&app.world).get_single().ok().cloned(); + + #[cfg(not(target_arch = "wasm32"))] match graphics::initialize_xr_graphics(primary_window.clone()) { Ok(( device, @@ -147,6 +149,11 @@ impl Plugin for OpenXrPlugin { app.insert_resource(XrEnableStatus::Disabled); } } + #[cfg(target_arch = "wasm32")] + { + app.add_plugins(RenderPlugin::default()); + app.insert_resource(XrEnableStatus::Disabled); + } } fn ready(&self, app: &App) -> bool {