Skip to content

Commit

Permalink
do not compile openxrs for wasm32 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmarni-Dev authored Dec 15, 2023
1 parent 265696b commit fcedb9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ impl Plugin for OpenXrPlugin {
let mut system_state: SystemState<Query<&RawHandleWrapper, With<PrimaryWindow>>> =
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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit fcedb9c

Please sign in to comment.