diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d522457..ab8bc11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,8 +22,7 @@ jobs: 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 - #cargo fmt --check + cargo fmt --check --all #cargo clippy --no-deps --tests -- -D warnings #cargo rustdoc -- -D warnings - name: "Build" diff --git a/Cargo.toml b/Cargo.toml index 1eacc55..ad067c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,28 @@ +[workspace] +resolver = "2" +members = [ + "examples/android", + "examples/demo", +] + +[workspace.package] +edition = "2021" +license = "MIT OR Apache-2.0" +repository = "https://github.com/awtterpip/bevy_oxr" + +[workspace.dependencies] +eyre = "0.6.2" +bevy = "0.13" +openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d" } +color-eyre = "0.6.2" + [package] name = "bevy_oxr" version = "0.1.0" -edition = "2021" description = "Community crate for OpenXR in Bevy" -repository = "https://github.com/awtterpip/bevy_oxr" -license = "MIT/Apache-2.0" - +edition.workspace = true +license.workspace = true +repository.workspace = true [features] default = ["vulkan", "d3d12"] @@ -13,47 +30,33 @@ force-link = ["openxr/linked"] vulkan = ["wgpu-core/vulkan"] d3d12 = ["wgpu-core/dx12", "dep:winapi", "dep:d3d12"] -[workspace] -members = ["examples/android", "examples/demo"] - [dependencies] -# anyhow = "1.0.75" ash = "0.37.3" -bevy = "0.13" +bevy.workspace = true +eyre.workspace = true futures-lite = "2.0.1" mint = "0.5.9" wgpu = "0.19" wgpu-core = { version = "0.19" } wgpu-hal = "0.19" -eyre = "0.6.11" [target.'cfg(windows)'.dependencies] -openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = [ - "linked", - "static", - "mint", -] } +openxr = { workspace = true, features = [ "linked", "static", "mint" ] } winapi = { version = "0.3.9", optional = true } d3d12 = { version = "0.19", features = ["libloading"], optional = true } [target.'cfg(all(target_family = "unix", not(target_arch = "wasm32")) )'.dependencies] -openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = [ - "mint", -] } +openxr = { workspace = true, features = [ "mint" ] } + [target.'cfg(all(not(target_family = "unix"), not(target_arch = "wasm32")))'.dependencies] -openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = [ - "mint", - "static", -] } +openxr = { workspace = true, features = [ "mint", "static" ] } [target.'cfg(target_os = "android")'.dependencies] ndk-context = "0.1" jni = "0.20" [dev-dependencies] -bevy = "0.13" -bevy_rapier3d = { git = "https://github.com/devil-ira/bevy_rapier", branch = "bevy-0.12" } -color-eyre = "0.6.2" +color-eyre.workspace = true [[example]] name = "xr" @@ -61,6 +64,3 @@ path = "examples/xr.rs" [profile.release] debug = true - -[patch.crates-io] -# ndk = { git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" } diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml index cafa8c2..11adab8 100644 --- a/examples/android/Cargo.toml +++ b/examples/android/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "bevy_openxr_android" version = "0.1.0" -edition = "2021" description = "Example for building an Android OpenXR app with Bevy" +edition.workspace = true +license.workspace = true publish = false -license = "MIT OR Apache-2.0" [lib] name = "bevy_openxr_android" @@ -12,9 +12,9 @@ crate-type = ["rlib", "cdylib"] [dependencies] -bevy_oxr.path = "../.." bevy = "0.13" -openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = ["mint"] } +bevy_oxr.path = "../.." +openxr = { workspace = true, features = ["mint"] } # [profile.release] # lto = "fat" diff --git a/examples/demo/Cargo.toml b/examples/demo/Cargo.toml index 00df137..31f7bca 100644 --- a/examples/demo/Cargo.toml +++ b/examples/demo/Cargo.toml @@ -1,31 +1,15 @@ [package] name = "demo" version = "0.1.0" -edition = "2021" +description = "Demo using bevy_oxr" +edition.workspace = true +publish = false [lib] crate-type = ["rlib", "cdylib"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -bevy = "0.13" +bevy.workspace = true bevy_oxr.path = "../../" -# bevy_rapier3d = { git = "https://github.com/devil-ira/bevy_rapier", branch = "bevy-0.12" } bevy_rapier3d = "0.25" -color-eyre = "0.6.2" - - -# [target.'cfg(not(target_os="android"))'.dependencies.bevy_oxr] -# path = "../../" -# # May need to be more specific. needs to be false at least on linux without an active runtime to run in flat -# default-features = true - -[profile.release] -debug = true - -[patch.crates-io] -ndk = { git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" } -ndk-sys = { package = "ndk-sys", git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" } -ndk-context = { package = "ndk-context", git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" } -ndk-glue = { package = "ndk-glue", git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" } +color-eyre.workspace = true diff --git a/examples/demo/src/lib.rs b/examples/demo/src/lib.rs index 4c4911a..05d96d8 100644 --- a/examples/demo/src/lib.rs +++ b/examples/demo/src/lib.rs @@ -1,27 +1,27 @@ -use std::{f32::consts::PI, ops::Mul, time::Duration}; +mod setup; + +use std::time::Duration; use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, ecs::schedule::ScheduleLabel, - input::{keyboard::KeyCode, ButtonInput}, log::info, math::primitives::{Capsule3d, Cuboid}, prelude::{ - bevy_main, default, shape, App, Assets, Color, Commands, Component, Entity, Event, - EventReader, EventWriter, FixedUpdate, Gizmos, GlobalTransform, IntoSystemConfigs, - IntoSystemSetConfigs, Mesh, PbrBundle, PostUpdate, Quat, Query, Res, ResMut, Resource, - Schedule, SpatialBundle, StandardMaterial, Startup, Transform, Update, Vec3, Vec3Swizzles, - With, Without, World, + bevy_main, default, App, Assets, Color, Commands, Component, Entity, Event, EventReader, + EventWriter, FixedUpdate, GlobalTransform, IntoSystemConfigs, IntoSystemSetConfigs, Mesh, + PbrBundle, PostUpdate, Query, Res, ResMut, Resource, Schedule, SpatialBundle, + StandardMaterial, Startup, Transform, Update, Vec3, With, Without, World, }, render::mesh::Meshable, time::{Fixed, Time, Timer, TimerMode}, transform::TransformSystem, }; use bevy_oxr::{ - graphics::{extensions::XrExtensions, XrAppInfo, XrPreferdBlendMode}, + graphics::{extensions::XrExtensions, XrAppInfo}, input::XrInput, - resources::{XrFrameState, XrInstance, XrSession}, - xr_init::{xr_only, XrStatus}, + resources::{XrFrameState, XrSession}, + xr_init::xr_only, xr_input::{ actions::XrActionSets, debug_gizmos::OpenXrDebugRenderer, @@ -34,29 +34,12 @@ use bevy_oxr::{ }, oculus_touch::OculusController, prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}, - trackers::{ - OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker, - OpenXRTrackingRoot, - }, + trackers::{OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker}, Hand, }, DefaultXrPlugins, }; -// fn input_stuff( -// keys: Res>, -// status: Res, -// mut request: EventWriter, -// ) { -// if keys.just_pressed(KeyCode::Space) { -// match status.into_inner() { -// XrEnableStatus::Enabled => request.send(XrEnableRequest::TryDisable), -// XrEnableStatus::Disabled => request.send(XrEnableRequest::TryEnable), -// } -// } -// } - -mod setup; use crate::setup::setup_scene; use bevy_rapier3d::prelude::*; @@ -376,7 +359,6 @@ fn update_physics_hands( )>, hand_query: Query<(&Transform, &HandBone, &Hand), Without>, time: Res