Skip to content

Commit

Permalink
Make "render" feature optional (bevyengine#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
smokku authored and mrk-its committed Oct 6, 2020
1 parent 4b53f35 commit a7219e0
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 15 deletions.
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ default = [
"bevy_gltf",
"bevy_wgpu",
"bevy_winit",
"render",
"dynamic_plugins",
"png",
"hdr",
Expand All @@ -34,7 +35,8 @@ dynamic_plugins = [
"bevy_app/dynamic_plugins",
"bevy_type_registry/dynamic_plugins",
]

# Rendering support
render = ["bevy_pbr", "bevy_render", "bevy_sprite", "bevy_text", "bevy_ui"]
# Image format support for texture loading (PNG and HDR are enabled by default)
png = ["bevy_render/png"]
hdr = ["bevy_render/hdr"]
Expand Down Expand Up @@ -65,21 +67,20 @@ bevy_diagnostic = { path = "crates/bevy_diagnostic", version = "0.1" }
bevy_ecs = { path = "crates/bevy_ecs", version = "0.1" }
bevy_input = { path = "crates/bevy_input", version = "0.1" }
bevy_math = { path = "crates/bevy_math", version = "0.1" }
bevy_pbr = { path = "crates/bevy_pbr", version = "0.1" }
bevy_property = { path = "crates/bevy_property", version = "0.1" }
bevy_render = { path = "crates/bevy_render", version = "0.1" }
bevy_scene = { path = "crates/bevy_scene", version = "0.1" }
bevy_sprite = { path = "crates/bevy_sprite", version = "0.1" }
bevy_transform = { path = "crates/bevy_transform", version = "0.1" }
bevy_text = { path = "crates/bevy_text", version = "0.1" }
bevy_ui = { path = "crates/bevy_ui", version = "0.1" }
bevy_utils = { path = "crates/bevy_utils", version = "0.1" }
bevy_window = { path = "crates/bevy_window", version = "0.1" }
bevy_tasks = { path = "crates/bevy_tasks", version = "0.1" }

# bevy (optional)
bevy_audio = { path = "crates/bevy_audio", optional = true, version = "0.1" }
bevy_gltf = { path = "crates/bevy_gltf", optional = true, version = "0.1" }
bevy_pbr = { path = "crates/bevy_pbr", optional = true, version = "0.1" }
bevy_render = { path = "crates/bevy_render", optional = true, version = "0.1" }
bevy_sprite = { path = "crates/bevy_sprite", optional = true, version = "0.1" }
bevy_text = { path = "crates/bevy_text", optional = true, version = "0.1" }
bevy_ui = { path = "crates/bevy_ui", optional = true, version = "0.1" }
bevy_wgpu = { path = "crates/bevy_wgpu", optional = true, version = "0.1" }
bevy_winit = { path = "crates/bevy_winit", optional = true, version = "0.1" }

Expand Down
10 changes: 10 additions & 0 deletions src/add_default_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ impl AddDefaultPlugins for AppBuilder {
self.add_plugin(bevy_window::WindowPlugin::default());
self.add_plugin(bevy_asset::AssetPlugin::default());
self.add_plugin(bevy_scene::ScenePlugin::default());

#[cfg(feature = "bevy_render")]
self.add_plugin(bevy_render::RenderPlugin::default());

#[cfg(feature = "bevy_sprite")]
self.add_plugin(bevy_sprite::SpritePlugin::default());

#[cfg(feature = "bevy_pbr")]
self.add_plugin(bevy_pbr::PbrPlugin::default());

#[cfg(feature = "bevy_ui")]
self.add_plugin(bevy_ui::UiPlugin::default());

#[cfg(feature = "bevy_text")]
self.add_plugin(bevy_text::TextPlugin::default());

#[cfg(feature = "bevy_audio")]
Expand Down
20 changes: 15 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@ pub use bevy_diagnostic as diagnostic;
pub use bevy_ecs as ecs;
pub use bevy_input as input;
pub use bevy_math as math;
pub use bevy_pbr as pbr;
pub use bevy_property as property;
pub use bevy_render as render;
pub use bevy_scene as scene;
pub use bevy_sprite as sprite;
pub use bevy_tasks as tasks;
pub use bevy_text as text;
pub use bevy_transform as transform;
pub use bevy_type_registry as type_registry;
pub use bevy_ui as ui;
pub use bevy_window as window;

#[cfg(feature = "bevy_audio")]
Expand All @@ -66,6 +61,21 @@ pub use bevy_audio as audio;
#[cfg(feature = "bevy_gltf")]
pub use bevy_gltf as gltf;

#[cfg(feature = "bevy_pbr")]
pub use bevy_pbr as pbr;

#[cfg(feature = "bevy_render")]
pub use bevy_render as render;

#[cfg(feature = "bevy_sprite")]
pub use bevy_sprite as sprite;

#[cfg(feature = "bevy_text")]
pub use bevy_text as text;

#[cfg(feature = "bevy_ui")]
pub use bevy_ui as ui;

#[cfg(feature = "bevy_winit")]
pub use bevy_winit as winit;

Expand Down
20 changes: 17 additions & 3 deletions src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
pub use crate::{
app::prelude::*, asset::prelude::*, core::prelude::*, ecs::prelude::*, input::prelude::*,
math::prelude::*, pbr::prelude::*, property::prelude::*, render::prelude::*, scene::prelude::*,
sprite::prelude::*, text::prelude::*, transform::prelude::*, type_registry::RegisterType,
ui::prelude::*, window::prelude::*, AddDefaultPlugins,
math::prelude::*, property::prelude::*, scene::prelude::*, transform::prelude::*,
type_registry::RegisterType, window::prelude::*, AddDefaultPlugins,
};

#[cfg(feature = "bevy_audio")]
pub use crate::audio::prelude::*;

#[cfg(feature = "bevy_pbr")]
pub use crate::pbr::prelude::*;

#[cfg(feature = "bevy_render")]
pub use crate::render::prelude::*;

#[cfg(feature = "bevy_sprite")]
pub use crate::sprite::prelude::*;

#[cfg(feature = "bevy_text")]
pub use crate::text::prelude::*;

#[cfg(feature = "bevy_ui")]
pub use crate::ui::prelude::*;

0 comments on commit a7219e0

Please sign in to comment.