From 0274698eb4e7ac741ba60437afe4412a634d6bc1 Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 13:38:52 -0500 Subject: [PATCH 1/9] Platform agnostic dep features, and troubleshooting in readme --- Cargo.toml | 10 +++++++--- README.md | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 71c036a..bab6369 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,19 +4,23 @@ version = "0.1.0" edition = "2021" [features] -default = ["linked"] -linked = ["openxr/linked", "openxr/static"] +default = ["openxr/mint"] [dependencies] anyhow = "1.0.75" ash = "0.37.3" bevy = "0.12" -openxr = { version = "0.17.1", features = ["mint"] } mint = "0.5.9" wgpu = "0.17.1" wgpu-core = { version = "0.17.1", features = ["vulkan"] } wgpu-hal = "0.17.1" +[target.'cfg( target_os = "linux" )'.dependencies] +openxr = { version = "0.17.1", features = ["linked"] } + +[target.'cfg(not(target_os = "linux"))'.dependencies] +openxr = { version = "0.17.1", features = ["linked", "static"] } + [dev-dependencies] bevy = "0.12" color-eyre = "0.6.2" diff --git a/README.md b/README.md index a0c7eb2..94cb820 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,11 @@ An in-progress crate for adding openxr support to Bevy without forking. ![image](https://github.com/awtterpip/bevy_openxr/assets/50841145/aa01fde4-7915-49b9-b486-ff61ce6d57a9) To see it in action run the example in `examples` with `cargo run --example xr` + +## Troubleshooting + +- I'm getting a `CMake error: ...` on Linux. + - Make sure you have the `openxr` package installed on your system. + - Append `--no-default-features` to your build command (example: `cargo run --example xr --no-default-features`) +- I'm getting poor performance. + - Like other bevy projects, make sure you're building in release (example: `cargo run --example xr --release`) From 4d71663c9f959feb84ab1c0015c066c56f7a0b33 Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 13:45:40 -0500 Subject: [PATCH 2/9] minor addition to readme troubleshooting section. --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 94cb820..8fe5d79 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ To see it in action run the example in `examples` with `cargo run --example xr` ## Troubleshooting -- I'm getting a `CMake error: ...` on Linux. - - Make sure you have the `openxr` package installed on your system. - - Append `--no-default-features` to your build command (example: `cargo run --example xr --no-default-features`) +- Make sure, if you're on Linux, that you have the `openxr` package installed on your system. - I'm getting poor performance. - Like other bevy projects, make sure you're building in release (example: `cargo run --example xr --release`) From a7edff6dffffa82105043c9de6c9e695eb503e09 Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:15:53 -0500 Subject: [PATCH 3/9] refactored `xr_entry` func. --- Cargo.toml | 2 +- src/graphics/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bab6369..534191e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ wgpu-hal = "0.17.1" openxr = { version = "0.17.1", features = ["linked"] } [target.'cfg(not(target_os = "linux"))'.dependencies] -openxr = { version = "0.17.1", features = ["linked", "static"] } +openxr = { version = "0.17.1", features = ["static"] } [dev-dependencies] bevy = "0.12" diff --git a/src/graphics/mod.rs b/src/graphics/mod.rs index 2a0a92d..2eb26dd 100644 --- a/src/graphics/mod.rs +++ b/src/graphics/mod.rs @@ -36,9 +36,9 @@ pub fn initialize_xr_graphics( } pub fn xr_entry() -> xr::Entry { - #[cfg(feature = "linked")] + #[cfg(target_os = "linux")] let entry = xr::Entry::linked(); - #[cfg(not(feature = "linked"))] + #[cfg(not(target_os = "linux"))] let entry = unsafe { xr::Entry::load().unwrap() }; entry } From 9963f5c1c942f73040765bcde454a6915bfebd3b Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:20:37 -0500 Subject: [PATCH 4/9] change back to using "linked" feature cfg. --- Cargo.toml | 5 +++-- src/graphics/mod.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 534191e..f7dfe4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" edition = "2021" [features] -default = ["openxr/mint"] +default = ["openxr/mint", "linked"] +linked = ["openxr/linked"] [dependencies] anyhow = "1.0.75" @@ -16,7 +17,7 @@ wgpu-core = { version = "0.17.1", features = ["vulkan"] } wgpu-hal = "0.17.1" [target.'cfg( target_os = "linux" )'.dependencies] -openxr = { version = "0.17.1", features = ["linked"] } +openxr = "0.17.1" [target.'cfg(not(target_os = "linux"))'.dependencies] openxr = { version = "0.17.1", features = ["static"] } diff --git a/src/graphics/mod.rs b/src/graphics/mod.rs index 2eb26dd..2a0a92d 100644 --- a/src/graphics/mod.rs +++ b/src/graphics/mod.rs @@ -36,9 +36,9 @@ pub fn initialize_xr_graphics( } pub fn xr_entry() -> xr::Entry { - #[cfg(target_os = "linux")] + #[cfg(feature = "linked")] let entry = xr::Entry::linked(); - #[cfg(not(target_os = "linux"))] + #[cfg(not(feature = "linked"))] let entry = unsafe { xr::Entry::load().unwrap() }; entry } From 8a24fde0d542c03bf72a262b666ca92c8302d4f3 Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:32:58 -0500 Subject: [PATCH 5/9] update to build step for dependencies. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b254df5..3fb1e74 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: "Cache" uses: Swatinem/rust-cache@v2 - name: "External dependencies" - run: sudo apt-get install -y libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libudev-dev + run: sudo apt-get install -y libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libudev-dev libopenxr-loader1 - name: "Checks" run: | cargo update From 79ad1f7022565b2feab925277d32337aed5ce8c8 Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:38:53 -0500 Subject: [PATCH 6/9] added 'libopenxr-dev' to dependencies --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fb1e74..d522457 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: "Cache" uses: Swatinem/rust-cache@v2 - name: "External dependencies" - run: sudo apt-get install -y libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libudev-dev libopenxr-loader1 + run: sudo apt-get install -y libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libudev-dev libopenxr-loader1 libopenxr-dev - name: "Checks" run: | cargo update From faac22acb8d2428b0ef1ef87234c85b8720bd92d Mon Sep 17 00:00:00 2001 From: 2-3-5-41 <93025618+2-3-5-41@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:02:30 -0500 Subject: [PATCH 7/9] change from `target_os` to `target_family`. --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f7dfe4e..ea3cc4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,10 @@ wgpu = "0.17.1" wgpu-core = { version = "0.17.1", features = ["vulkan"] } wgpu-hal = "0.17.1" -[target.'cfg( target_os = "linux" )'.dependencies] +[target.'cfg( target_family = "unix" )'.dependencies] openxr = "0.17.1" -[target.'cfg(not(target_os = "linux"))'.dependencies] +[target.'cfg(not(target_family = "unix"))'.dependencies] openxr = { version = "0.17.1", features = ["static"] } [dev-dependencies] From 52ffa2fdc87c038eadd9dafc5f4fc6c4712a0247 Mon Sep 17 00:00:00 2001 From: MalekiRe Date: Mon, 6 Nov 2023 15:55:36 -0800 Subject: [PATCH 8/9] changed things to bevy_oxr instead of bevy_openxr and made the android example part of the workspace --- Cargo.toml | 5 ++++- examples/android/Cargo.toml | 2 +- examples/android/src/lib.rs | 8 ++++---- examples/xr.rs | 18 +++++++++--------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ea3cc4e..6472aff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bevy_openxr" +name = "bevy_oxr" version = "0.1.0" edition = "2021" @@ -7,6 +7,9 @@ edition = "2021" default = ["openxr/mint", "linked"] linked = ["openxr/linked"] +[workspace] +members = [ "examples/android" ] + [dependencies] anyhow = "1.0.75" ash = "0.37.3" diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml index 3272734..d084c7e 100644 --- a/examples/android/Cargo.toml +++ b/examples/android/Cargo.toml @@ -29,7 +29,7 @@ target_sdk_version = 32 # label = "Bevy Example" [dependencies] -bevy_openxr = { path = "../..", default-features = false } +bevy_oxr = { path = "../..", default-features = false } bevy = "0.12" openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] } diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs index d5501df..4f8bdeb 100644 --- a/examples/android/src/lib.rs +++ b/examples/android/src/lib.rs @@ -1,12 +1,12 @@ use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy::prelude::*; use bevy::transform::components::Transform; -use bevy_openxr::xr_input::debug_gizmos::OpenXrDebugRenderer; -use bevy_openxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}; -use bevy_openxr::xr_input::trackers::{ +use bevy_oxr::xr_input::debug_gizmos::OpenXrDebugRenderer; +use bevy_oxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}; +use bevy_oxr::xr_input::trackers::{ OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker, }; -use bevy_openxr::DefaultXrPlugins; +use bevy_oxr::DefaultXrPlugins; #[bevy_main] fn main() { diff --git a/examples/xr.rs b/examples/xr.rs index 8644265..b8dc849 100644 --- a/examples/xr.rs +++ b/examples/xr.rs @@ -4,22 +4,22 @@ use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy::prelude::*; use bevy::transform::components::Transform; -use bevy_openxr::input::XrInput; -use bevy_openxr::resources::{XrFrameState, XrInstance, XrSession}; +use bevy_oxr::input::XrInput; +use bevy_oxr::resources::{XrFrameState, XrInstance, XrSession}; -use bevy_openxr::xr_input::hand::{OpenXrHandInput, HandInputDebugRenderer}; -use bevy_openxr::xr_input::interactions::{ +use bevy_oxr::xr_input::hand::{OpenXrHandInput, HandInputDebugRenderer}; +use bevy_oxr::xr_input::interactions::{ draw_interaction_gizmos, draw_socket_gizmos, interactions, socket_interactions, update_interactable_states, InteractionEvent, Touched, XRDirectInteractor, XRInteractable, XRInteractableState, XRInteractorState, XRRayInteractor, XRSocketInteractor, }; -use bevy_openxr::xr_input::oculus_touch::OculusController; -use bevy_openxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}; -use bevy_openxr::xr_input::trackers::{ +use bevy_oxr::xr_input::oculus_touch::OculusController; +use bevy_oxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}; +use bevy_oxr::xr_input::trackers::{ AimPose, OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker, }; -use bevy_openxr::xr_input::Hand; -use bevy_openxr::DefaultXrPlugins; +use bevy_oxr::xr_input::Hand; +use bevy_oxr::DefaultXrPlugins; fn main() { color_eyre::install().unwrap(); From a807b285d48b6fdb7f79fa8d7360f89b56ffe5b2 Mon Sep 17 00:00:00 2001 From: MalekiRe Date: Mon, 6 Nov 2023 16:44:58 -0800 Subject: [PATCH 9/9] added licenses to cargo.toml --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6472aff..3a497cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,8 @@ name = "bevy_oxr" version = "0.1.0" edition = "2021" +description = "Community crate for OpenXR in Bevy" +license = "MIT/Apache-2.0" [features] default = ["openxr/mint", "linked"]