Skip to content

Commit

Permalink
Make bevy_math optional in bevy_core
Browse files Browse the repository at this point in the history
Notably, this makes bevy_core, bevy_diagnostic, and bevy_asset no longer
require pulling in bevy_math. None of these crates directly depend on
the math primitives, so this is a net positive for use outside of bevy,
which can now use these crates without pulling in bevy_math and glam.
  • Loading branch information
CAD97 committed Oct 7, 2021
1 parent 2974293 commit 7859620
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions crates/bevy_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
bevy = ["bevy_math", "bevy_reflect/bevy"]

[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.5.0" }
bevy_derive = { path = "../bevy_derive", version = "0.5.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0" }
bevy_math = { path = "../bevy_math", version = "0.5.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.5.0", features = ["bevy"] }
bevy_math = { path = "../bevy_math", version = "0.5.0", optional = true }
bevy_reflect = { path = "../bevy_reflect", version = "0.5.0" }
bevy_tasks = { path = "../bevy_tasks", version = "0.5.0" }
bevy_utils = { path = "../bevy_utils", version = "0.5.0" }

# other
bytemuck = "1.5"

[dev-dependencies]
bevy_math = { path = "../bevy_math", version = "0.5.0" }
2 changes: 2 additions & 0 deletions crates/bevy_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl Plugin for CorePlugin {
.add_system_to_stage(CoreStage::PostUpdate, entity_labels_system);

register_rust_types(app);
#[cfg(feature = "bevy_math")]
register_math_types(app);
}
}
Expand All @@ -90,6 +91,7 @@ fn register_rust_types(app: &mut App) {
.register_type::<Option<String>>();
}

#[cfg(feature = "bevy_math")]
fn register_math_types(app: &mut App) {
app.register_type::<bevy_math::IVec2>()
.register_type::<bevy_math::IVec3>()
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bevy_ci_testing = ["bevy_app/bevy_ci_testing"]
# bevy
bevy_app = { path = "../bevy_app", version = "0.5.0" }
bevy_asset = { path = "../bevy_asset", version = "0.5.0" }
bevy_core = { path = "../bevy_core", version = "0.5.0" }
bevy_core = { path = "../bevy_core", version = "0.5.0", features = ["bevy"] }
bevy_derive = { path = "../bevy_derive", version = "0.5.0" }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.5.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0" }
Expand Down

0 comments on commit 7859620

Please sign in to comment.