mirror of
https://github.com/bevyengine/bevy
synced 2024-11-14 00:47:32 +00:00
Make sysinfo diagnostic plugin optional (#12164)
# Objective - Fixes https://github.com/bevyengine/bevy/issues/11929 - make sysinfo plugin optional ## Solution - added features to allow for conditional compilation --- ## Migration Guide - For users who disable default features of bevy and wish to enable the diagnostic plugin, add `sysinfo_plugin` to your bevy features list. --------- Co-authored-by: ebola <dev@axiomatic> Co-authored-by: François <mockersf@gmail.com>
This commit is contained in:
parent
c13de09feb
commit
7826313405
5 changed files with 19 additions and 5 deletions
|
@ -77,12 +77,16 @@ default = [
|
||||||
"tonemapping_luts",
|
"tonemapping_luts",
|
||||||
"default_font",
|
"default_font",
|
||||||
"webgl2",
|
"webgl2",
|
||||||
|
"sysinfo_plugin",
|
||||||
"bevy_debug_stepping",
|
"bevy_debug_stepping",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Force dynamic linking, which improves iterative compile times
|
# Force dynamic linking, which improves iterative compile times
|
||||||
dynamic_linking = ["dep:bevy_dylib", "bevy_internal/dynamic_linking"]
|
dynamic_linking = ["dep:bevy_dylib", "bevy_internal/dynamic_linking"]
|
||||||
|
|
||||||
|
# Enables system information diagnostic plugin
|
||||||
|
sysinfo_plugin = ["bevy_internal/sysinfo_plugin"]
|
||||||
|
|
||||||
# Provides animation functionality
|
# Provides animation functionality
|
||||||
bevy_animation = ["bevy_internal/bevy_animation", "bevy_color"]
|
bevy_animation = ["bevy_internal/bevy_animation", "bevy_color"]
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ keywords = ["bevy"]
|
||||||
[features]
|
[features]
|
||||||
# Disables diagnostics that are unsupported when Bevy is dynamically linked
|
# Disables diagnostics that are unsupported when Bevy is dynamically linked
|
||||||
dynamic_linking = []
|
dynamic_linking = []
|
||||||
|
sysinfo_plugin = ["sysinfo"]
|
||||||
|
features = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# bevy
|
# bevy
|
||||||
|
@ -26,13 +28,13 @@ const-fnv1a-hash = "1.1.0"
|
||||||
# MacOS
|
# MacOS
|
||||||
[target.'cfg(all(target_os="macos"))'.dependencies]
|
[target.'cfg(all(target_os="macos"))'.dependencies]
|
||||||
# Some features of sysinfo are not supported by apple. This will disable those features on apple devices
|
# Some features of sysinfo are not supported by apple. This will disable those features on apple devices
|
||||||
sysinfo = { version = "0.30.0", default-features = false, features = [
|
sysinfo = { version = "0.30.0", optional = true, default-features = false, features = [
|
||||||
"apple-app-store",
|
"apple-app-store",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
# Only include when not bevy_dynamic_plugin and on linux/windows/android
|
# Only include when not bevy_dynamic_plugin and on linux/windows/android
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "android"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "android"))'.dependencies]
|
||||||
sysinfo = { version = "0.30.0", default-features = false }
|
sysinfo = { version = "0.30.0", optional = true, default-features = false }
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
|
@ -9,22 +9,27 @@ mod diagnostic;
|
||||||
mod entity_count_diagnostics_plugin;
|
mod entity_count_diagnostics_plugin;
|
||||||
mod frame_time_diagnostics_plugin;
|
mod frame_time_diagnostics_plugin;
|
||||||
mod log_diagnostics_plugin;
|
mod log_diagnostics_plugin;
|
||||||
|
#[cfg(feature = "sysinfo_plugin")]
|
||||||
mod system_information_diagnostics_plugin;
|
mod system_information_diagnostics_plugin;
|
||||||
|
|
||||||
use bevy_app::prelude::*;
|
|
||||||
pub use diagnostic::*;
|
pub use diagnostic::*;
|
||||||
|
|
||||||
pub use entity_count_diagnostics_plugin::EntityCountDiagnosticsPlugin;
|
pub use entity_count_diagnostics_plugin::EntityCountDiagnosticsPlugin;
|
||||||
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
|
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
|
||||||
pub use log_diagnostics_plugin::LogDiagnosticsPlugin;
|
pub use log_diagnostics_plugin::LogDiagnosticsPlugin;
|
||||||
|
#[cfg(feature = "sysinfo_plugin")]
|
||||||
pub use system_information_diagnostics_plugin::SystemInformationDiagnosticsPlugin;
|
pub use system_information_diagnostics_plugin::SystemInformationDiagnosticsPlugin;
|
||||||
|
|
||||||
|
use bevy_app::prelude::*;
|
||||||
|
|
||||||
/// Adds core diagnostics resources to an App.
|
/// Adds core diagnostics resources to an App.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct DiagnosticsPlugin;
|
pub struct DiagnosticsPlugin;
|
||||||
|
|
||||||
impl Plugin for DiagnosticsPlugin {
|
impl Plugin for DiagnosticsPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, _app: &mut App) {
|
||||||
app.init_resource::<DiagnosticsStore>().add_systems(
|
#[cfg(feature = "sysinfo_plugin")]
|
||||||
|
_app.init_resource::<DiagnosticsStore>().add_systems(
|
||||||
Startup,
|
Startup,
|
||||||
system_information_diagnostics_plugin::internal::log_system_info,
|
system_information_diagnostics_plugin::internal::log_system_info,
|
||||||
);
|
);
|
||||||
|
|
|
@ -25,6 +25,8 @@ trace_tracy_memory = ["bevy_log/trace_tracy_memory"]
|
||||||
wgpu_trace = ["bevy_render/wgpu_trace"]
|
wgpu_trace = ["bevy_render/wgpu_trace"]
|
||||||
detailed_trace = ["bevy_utils/detailed_trace"]
|
detailed_trace = ["bevy_utils/detailed_trace"]
|
||||||
|
|
||||||
|
sysinfo_plugin = ["bevy_diagnostic/sysinfo_plugin"]
|
||||||
|
|
||||||
# Image format support for texture loading (PNG and HDR are enabled by default)
|
# Image format support for texture loading (PNG and HDR are enabled by default)
|
||||||
exr = ["bevy_render/exr"]
|
exr = ["bevy_render/exr"]
|
||||||
hdr = ["bevy_render/hdr"]
|
hdr = ["bevy_render/hdr"]
|
||||||
|
|
|
@ -34,6 +34,7 @@ The default feature set enables most of the expected features of a game engine,
|
||||||
|ktx2|KTX2 compressed texture support|
|
|ktx2|KTX2 compressed texture support|
|
||||||
|multi-threaded|Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.|
|
|multi-threaded|Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.|
|
||||||
|png|PNG image format support|
|
|png|PNG image format support|
|
||||||
|
|sysinfo_plugin|Enables system information diagnostic plugin|
|
||||||
|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the `Tonemapping` method on your `Camera2dBundle` or `Camera3dBundle`.|
|
|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the `Tonemapping` method on your `Camera2dBundle` or `Camera3dBundle`.|
|
||||||
|vorbis|OGG/VORBIS audio format support|
|
|vorbis|OGG/VORBIS audio format support|
|
||||||
|webgl2|Enable some limitations to be able to use WebGL2. Please refer to the [WebGL2 and WebGPU](https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu) section of the examples README for more information on how to run Wasm builds with WebGPU.|
|
|webgl2|Enable some limitations to be able to use WebGL2. Please refer to the [WebGL2 and WebGPU](https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu) section of the examples README for more information on how to run Wasm builds with WebGPU.|
|
||||||
|
|
Loading…
Reference in a new issue