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/7] 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 71c036a8..bab63697 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 a0c7eb27..94cb820e 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/7] 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 94cb820e..8fe5d79a 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/7] 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 bab63697..534191e9 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 2a0a92db..2eb26dda 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/7] 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 534191e9..f7dfe4e9 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 2eb26dda..2a0a92db 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/7] 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 b254df5e..3fb1e743 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/7] 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 3fb1e743..d522457d 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/7] 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 f7dfe4e9..ea3cc4e2 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]