diff --git a/Cargo.toml b/Cargo.toml index 393c226..447417d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,13 +18,16 @@ bevy = { version = "0.12", features = [ "jpeg", ] } ## NOT the local file bevy, the one from the net bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" } ## control -bevy_oxr = { git = "https://github.com/awtterpip/bevy_openxr" } +bevy_oxr = { git = "https://github.com/awtterpip/bevy_openxr", optional = true } ## bevy_config_cam = { git = "https://github.com/BlackPhlox/bevy_config_cam" } ## { version = "0.3.0"} glam = "0" [features] -#xr = ["bevy_oxr"] +xr = ["dep:bevy_oxr"] + +[target.'cfg(not(target_os="macos"))'.features] +default = ["xr"] #jpeg = ["bevy_internal/jpeg"] diff --git a/src/main.rs b/src/main.rs index 14c0377..8417643 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,17 +6,21 @@ use bevy::{ }; use std::f32::consts::*; use tilemap::TileMap; +#[cfg(feature = "xr")] use xr::XRPlugin; use bevy_flycam::prelude::*; +#[cfg(feature = "xr")] use bevy_oxr::DefaultXrPlugins; mod tilemap; +#[cfg(feature = "xr")] mod xr; fn main() { let mut app = App::new(); if std::env::args().any(|arg| arg == "xr") { + #[cfg(feature = "xr")] app.add_plugins(DefaultXrPlugins).add_plugins(XRPlugin); } else { app.add_plugins(DefaultPlugins);