Upgrade to Glam 0.29.3 and Simplify Feature Gating (#18638)
# Objective - Fixes #18397 - Supersedes #18474 - Simplifies 0.16 migration ## Solution - Upgrade to Glam 0.29.3, which has backported the `nostd-libm` feature. - Expose a similar feature in `bevy_math` and enable it in `bevy_internal`, allowing `bevy_math`, `bevy_input`, and `bevy_transform` to be unconditional dependencies again. ## Testing - CI --- ## Notes - This includes `libm` as a dependency, but this was already the case in the common scenario where `rand` or many other features were enabled. Considering `libm` is an official Rust crate, it's a very low-risk dependency to unconditionally include. - For users who do not want `libm` included, simply import Bevy's subcrates directly, since `bevy_math/nostd-libm` will not be enabled. - I know we are _very_ late in the RC cycle for 0.16, but this has a substantial impact on the usability of `bevy` that I consider worth including.
This commit is contained in:
parent
7826b94e06
commit
45e2398b51
@ -91,11 +91,11 @@ serialize = [
|
|||||||
"bevy_color?/serialize",
|
"bevy_color?/serialize",
|
||||||
"bevy_ecs/serialize",
|
"bevy_ecs/serialize",
|
||||||
"bevy_image?/serialize",
|
"bevy_image?/serialize",
|
||||||
"bevy_input?/serialize",
|
"bevy_input/serialize",
|
||||||
"bevy_math?/serialize",
|
"bevy_math/serialize",
|
||||||
"bevy_scene?/serialize",
|
"bevy_scene?/serialize",
|
||||||
"bevy_time/serialize",
|
"bevy_time/serialize",
|
||||||
"bevy_transform?/serialize",
|
"bevy_transform/serialize",
|
||||||
"bevy_ui?/serialize",
|
"bevy_ui?/serialize",
|
||||||
"bevy_window?/serialize",
|
"bevy_window?/serialize",
|
||||||
"bevy_winit?/serialize",
|
"bevy_winit?/serialize",
|
||||||
@ -311,7 +311,7 @@ critical-section = [
|
|||||||
"bevy_app/critical-section",
|
"bevy_app/critical-section",
|
||||||
"bevy_diagnostic/critical-section",
|
"bevy_diagnostic/critical-section",
|
||||||
"bevy_ecs/critical-section",
|
"bevy_ecs/critical-section",
|
||||||
"bevy_input?/critical-section",
|
"bevy_input/critical-section",
|
||||||
"bevy_input_focus?/critical-section",
|
"bevy_input_focus?/critical-section",
|
||||||
"bevy_platform_support/critical-section",
|
"bevy_platform_support/critical-section",
|
||||||
"bevy_reflect/critical-section",
|
"bevy_reflect/critical-section",
|
||||||
@ -337,7 +337,7 @@ async_executor = [
|
|||||||
"std",
|
"std",
|
||||||
"bevy_tasks/async_executor",
|
"bevy_tasks/async_executor",
|
||||||
"bevy_ecs/async_executor",
|
"bevy_ecs/async_executor",
|
||||||
"bevy_transform?/async_executor",
|
"bevy_transform/async_executor",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Enables use of browser APIs.
|
# Enables use of browser APIs.
|
||||||
@ -361,10 +361,11 @@ bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev", default-features = fa
|
|||||||
] }
|
] }
|
||||||
bevy_input = { path = "../bevy_input", version = "0.16.0-dev", default-features = false, features = [
|
bevy_input = { path = "../bevy_input", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"bevy_reflect",
|
"bevy_reflect",
|
||||||
], optional = true }
|
] }
|
||||||
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", default-features = false, features = [
|
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"bevy_reflect",
|
"bevy_reflect",
|
||||||
], optional = true }
|
"nostd-libm",
|
||||||
|
] }
|
||||||
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"alloc",
|
"alloc",
|
||||||
] }
|
] }
|
||||||
@ -378,7 +379,7 @@ bevy_time = { path = "../bevy_time", version = "0.16.0-dev", default-features =
|
|||||||
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev", default-features = false, features = [
|
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"bevy-support",
|
"bevy-support",
|
||||||
"bevy_reflect",
|
"bevy_reflect",
|
||||||
], optional = true }
|
] }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev", default-features = false, features = [
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"alloc",
|
"alloc",
|
||||||
] }
|
] }
|
||||||
|
@ -9,10 +9,8 @@ plugin_group! {
|
|||||||
bevy_app:::TaskPoolPlugin,
|
bevy_app:::TaskPoolPlugin,
|
||||||
bevy_diagnostic:::FrameCountPlugin,
|
bevy_diagnostic:::FrameCountPlugin,
|
||||||
bevy_time:::TimePlugin,
|
bevy_time:::TimePlugin,
|
||||||
#[custom(cfg(any(feature = "libm", feature = "std")))]
|
|
||||||
bevy_transform:::TransformPlugin,
|
bevy_transform:::TransformPlugin,
|
||||||
bevy_diagnostic:::DiagnosticsPlugin,
|
bevy_diagnostic:::DiagnosticsPlugin,
|
||||||
#[custom(cfg(any(feature = "libm", feature = "std")))]
|
|
||||||
bevy_input:::InputPlugin,
|
bevy_input:::InputPlugin,
|
||||||
#[custom(cfg(not(feature = "bevy_window")))]
|
#[custom(cfg(not(feature = "bevy_window")))]
|
||||||
bevy_app:::ScheduleRunnerPlugin,
|
bevy_app:::ScheduleRunnerPlugin,
|
||||||
|
@ -41,13 +41,11 @@ pub use bevy_gizmos as gizmos;
|
|||||||
pub use bevy_gltf as gltf;
|
pub use bevy_gltf as gltf;
|
||||||
#[cfg(feature = "bevy_image")]
|
#[cfg(feature = "bevy_image")]
|
||||||
pub use bevy_image as image;
|
pub use bevy_image as image;
|
||||||
#[cfg(any(feature = "libm", feature = "std"))]
|
|
||||||
pub use bevy_input as input;
|
pub use bevy_input as input;
|
||||||
#[cfg(feature = "bevy_input_focus")]
|
#[cfg(feature = "bevy_input_focus")]
|
||||||
pub use bevy_input_focus as input_focus;
|
pub use bevy_input_focus as input_focus;
|
||||||
#[cfg(feature = "bevy_log")]
|
#[cfg(feature = "bevy_log")]
|
||||||
pub use bevy_log as log;
|
pub use bevy_log as log;
|
||||||
#[cfg(any(feature = "libm", feature = "std"))]
|
|
||||||
pub use bevy_math as math;
|
pub use bevy_math as math;
|
||||||
#[cfg(feature = "bevy_pbr")]
|
#[cfg(feature = "bevy_pbr")]
|
||||||
pub use bevy_pbr as pbr;
|
pub use bevy_pbr as pbr;
|
||||||
@ -70,7 +68,6 @@ pub use bevy_tasks as tasks;
|
|||||||
#[cfg(feature = "bevy_text")]
|
#[cfg(feature = "bevy_text")]
|
||||||
pub use bevy_text as text;
|
pub use bevy_text as text;
|
||||||
pub use bevy_time as time;
|
pub use bevy_time as time;
|
||||||
#[cfg(any(feature = "libm", feature = "std"))]
|
|
||||||
pub use bevy_transform as transform;
|
pub use bevy_transform as transform;
|
||||||
#[cfg(feature = "bevy_ui")]
|
#[cfg(feature = "bevy_ui")]
|
||||||
pub use bevy_ui as ui;
|
pub use bevy_ui as ui;
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
app::prelude::*, ecs::prelude::*, platform_support::prelude::*, reflect::prelude::*,
|
app::prelude::*, ecs::prelude::*, input::prelude::*, math::prelude::*,
|
||||||
time::prelude::*, utils::prelude::*, DefaultPlugins, MinimalPlugins,
|
platform_support::prelude::*, reflect::prelude::*, time::prelude::*, transform::prelude::*,
|
||||||
|
utils::prelude::*, DefaultPlugins, MinimalPlugins,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[cfg(any(feature = "libm", feature = "std"))]
|
|
||||||
pub use crate::{input::prelude::*, math::prelude::*, transform::prelude::*};
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[cfg(feature = "bevy_log")]
|
#[cfg(feature = "bevy_log")]
|
||||||
pub use crate::log::prelude::*;
|
pub use crate::log::prelude::*;
|
||||||
|
@ -10,7 +10,7 @@ keywords = ["bevy"]
|
|||||||
rust-version = "1.85.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glam = { version = "0.29", default-features = false, features = ["bytemuck"] }
|
glam = { version = "0.29.3", default-features = false, features = ["bytemuck"] }
|
||||||
thiserror = { version = "2", default-features = false }
|
thiserror = { version = "2", default-features = false }
|
||||||
derive_more = { version = "1", default-features = false, features = [
|
derive_more = { version = "1", default-features = false, features = [
|
||||||
"from",
|
"from",
|
||||||
@ -37,7 +37,7 @@ rand = "0.8"
|
|||||||
rand_chacha = "0.3"
|
rand_chacha = "0.3"
|
||||||
# Enable the approx feature when testing.
|
# Enable the approx feature when testing.
|
||||||
bevy_math = { path = ".", default-features = false, features = ["approx"] }
|
bevy_math = { path = ".", default-features = false, features = ["approx"] }
|
||||||
glam = { version = "0.29", default-features = false, features = ["approx"] }
|
glam = { version = "0.29.3", default-features = false, features = ["approx"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "rand", "curve"]
|
default = ["std", "rand", "curve"]
|
||||||
@ -77,6 +77,9 @@ rand = ["dep:rand", "dep:rand_distr", "glam/rand"]
|
|||||||
curve = []
|
curve = []
|
||||||
# Enable bevy_reflect (requires alloc)
|
# Enable bevy_reflect (requires alloc)
|
||||||
bevy_reflect = ["dep:bevy_reflect", "alloc"]
|
bevy_reflect = ["dep:bevy_reflect", "alloc"]
|
||||||
|
# Enable libm mathematical functions as a fallback for no_std environments.
|
||||||
|
# Can be overridden with std feature.
|
||||||
|
nostd-libm = ["dep:libm", "glam/nostd-libm"]
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// - `f32::gamma`
|
// - `f32::gamma`
|
||||||
// - `f32::ln_gamma`
|
// - `f32::ln_gamma`
|
||||||
|
|
||||||
#[cfg(not(feature = "libm"))]
|
#[cfg(all(not(feature = "libm"), feature = "std"))]
|
||||||
#[expect(
|
#[expect(
|
||||||
clippy::disallowed_methods,
|
clippy::disallowed_methods,
|
||||||
reason = "Many of the disallowed methods are disallowed to force code to use the feature-conditional re-exports from this module, but this module itself is exempt from that rule."
|
reason = "Many of the disallowed methods are disallowed to force code to use the feature-conditional re-exports from this module, but this module itself is exempt from that rule."
|
||||||
@ -233,7 +233,7 @@ mod std_ops {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "libm")]
|
#[cfg(any(feature = "libm", all(feature = "nostd-libm", not(feature = "std"))))]
|
||||||
mod libm_ops {
|
mod libm_ops {
|
||||||
|
|
||||||
/// Raises a number to a floating point power.
|
/// Raises a number to a floating point power.
|
||||||
@ -448,7 +448,7 @@ mod libm_ops {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "libm", not(feature = "std")))]
|
#[cfg(all(any(feature = "libm", feature = "nostd-libm"), not(feature = "std")))]
|
||||||
mod libm_ops_for_no_std {
|
mod libm_ops_for_no_std {
|
||||||
//! Provides standardized names for [`f32`] operations which may not be
|
//! Provides standardized names for [`f32`] operations which may not be
|
||||||
//! supported on `no_std` platforms.
|
//! supported on `no_std` platforms.
|
||||||
@ -606,20 +606,24 @@ mod std_ops_for_no_std {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "libm")]
|
#[cfg(any(feature = "libm", all(feature = "nostd-libm", not(feature = "std"))))]
|
||||||
pub use libm_ops::*;
|
pub use libm_ops::*;
|
||||||
|
|
||||||
#[cfg(not(feature = "libm"))]
|
#[cfg(all(not(feature = "libm"), feature = "std"))]
|
||||||
pub use std_ops::*;
|
pub use std_ops::*;
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub use std_ops_for_no_std::*;
|
pub use std_ops_for_no_std::*;
|
||||||
|
|
||||||
#[cfg(all(feature = "libm", not(feature = "std")))]
|
#[cfg(all(any(feature = "libm", feature = "nostd-libm"), not(feature = "std")))]
|
||||||
pub use libm_ops_for_no_std::*;
|
pub use libm_ops_for_no_std::*;
|
||||||
|
|
||||||
#[cfg(all(not(feature = "libm"), not(feature = "std")))]
|
#[cfg(all(
|
||||||
compile_error!("Either the `libm` feature or the `std` feature must be enabled.");
|
not(feature = "libm"),
|
||||||
|
not(feature = "std"),
|
||||||
|
not(feature = "nostd-libm")
|
||||||
|
))]
|
||||||
|
compile_error!("Either the `libm`, `std`, or `nostd-libm` feature must be enabled.");
|
||||||
|
|
||||||
/// This extension trait covers shortfall in determinacy from the lack of a `libm` counterpart
|
/// This extension trait covers shortfall in determinacy from the lack of a `libm` counterpart
|
||||||
/// to `f32::powi`. Use this for the common small exponents.
|
/// to `f32::powi`. Use this for the common small exponents.
|
||||||
|
@ -22,7 +22,7 @@ std = ["glam/std"]
|
|||||||
libm = ["glam/libm", "dep:libm"]
|
libm = ["glam/libm", "dep:libm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glam = { version = "0.29.0", default-features = false }
|
glam = { version = "0.29.3", default-features = false }
|
||||||
libm = { version = "0.2", default-features = false, optional = true }
|
libm = { version = "0.2", default-features = false, optional = true }
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
|
@ -99,7 +99,7 @@ derive_more = { version = "1", default-features = false, features = ["from"] }
|
|||||||
serde = { version = "1", default-features = false, features = ["alloc"] }
|
serde = { version = "1", default-features = false, features = ["alloc"] }
|
||||||
assert_type_match = "0.1.1"
|
assert_type_match = "0.1.1"
|
||||||
smallvec = { version = "1.11", default-features = false, optional = true }
|
smallvec = { version = "1.11", default-features = false, optional = true }
|
||||||
glam = { version = "0.29.2", default-features = false, features = [
|
glam = { version = "0.29.3", default-features = false, features = [
|
||||||
"serde",
|
"serde",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
petgraph = { version = "0.7", features = ["serde-1"], optional = true }
|
petgraph = { version = "0.7", features = ["serde-1"], optional = true }
|
||||||
|
Loading…
Reference in New Issue
Block a user