Skip to content

Commit

Permalink
Add bevy_dylib to force dynamic linking of bevy
Browse files Browse the repository at this point in the history
This easily improve compilation time by 2x
  • Loading branch information
bjorn3 committed Nov 7, 2020
1 parent d682cc6 commit a1a3750
Show file tree
Hide file tree
Showing 62 changed files with 893 additions and 243 deletions.
72 changes: 4 additions & 68 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,90 +1,26 @@
[package]
name = "bevy"
name = "bevy_examples"
version = "0.3.0"
edition = "2018"
authors = [
"Bevy Contributors <[email protected]>",
"Carter Anderson <[email protected]>",
]
description = "A refreshingly simple data-driven game engine and app framework"
description = "Examples for the Bevy game engine"
homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
license = "MIT"
keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
categories = ["game-engines", "graphics", "gui", "rendering"]
readme = "README.md"
exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"]

[features]
default = [
"bevy_audio",
"bevy_dynamic_plugin",
"bevy_gilrs",
"bevy_gltf",
"bevy_wgpu",
"bevy_winit",
"render",
"png",
"hdr",
"mp3",
"x11",
]

profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"]
wgpu_trace = ["bevy_wgpu/trace"]

# 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"]

# Audio format support (MP3 is enabled by default)
mp3 = ["bevy_audio/mp3"]
flac = ["bevy_audio/flac"]
wav = ["bevy_audio/wav"]
vorbis = ["bevy_audio/vorbis"]

serialize = ["bevy_input/serialize"]

# Display server protocol support (X11 is enabled by default)
wayland = ["bevy_winit/wayland"]
x11 = ["bevy_winit/x11"]

[workspace]
members = ["crates/*", "crates/bevy_ecs/hecs", "examples/ios"]
exclude = ["benches"]

[dependencies]
# bevy
bevy_app = { path = "crates/bevy_app", version = "0.3.0" }
bevy_asset = { path = "crates/bevy_asset", version = "0.3.0" }
bevy_type_registry = { path = "crates/bevy_type_registry", version = "0.3.0" }
bevy_core = { path = "crates/bevy_core", version = "0.3.0" }
bevy_diagnostic = { path = "crates/bevy_diagnostic", version = "0.3.0" }
bevy_ecs = { path = "crates/bevy_ecs", version = "0.3.0" }
bevy_input = { path = "crates/bevy_input", version = "0.3.0" }
bevy_math = { path = "crates/bevy_math", version = "0.3.0" }
bevy_property = { path = "crates/bevy_property", version = "0.3.0" }
bevy_scene = { path = "crates/bevy_scene", version = "0.3.0" }
bevy_transform = { path = "crates/bevy_transform", version = "0.3.0" }
bevy_utils = { path = "crates/bevy_utils", version = "0.3.0" }
bevy_window = { path = "crates/bevy_window", version = "0.3.0" }
bevy_tasks = { path = "crates/bevy_tasks", version = "0.3.0" }
# bevy (optional)
bevy_audio = { path = "crates/bevy_audio", optional = true, version = "0.3.0" }
bevy_gltf = { path = "crates/bevy_gltf", optional = true, version = "0.3.0" }
bevy_pbr = { path = "crates/bevy_pbr", optional = true, version = "0.3.0" }
bevy_render = { path = "crates/bevy_render", optional = true, version = "0.3.0" }
bevy_dynamic_plugin = { path = "crates/bevy_dynamic_plugin", optional = true, version = "0.3.0" }
bevy_sprite = { path = "crates/bevy_sprite", optional = true, version = "0.3.0" }
bevy_text = { path = "crates/bevy_text", optional = true, version = "0.3.0" }
bevy_ui = { path = "crates/bevy_ui", optional = true, version = "0.3.0" }
bevy_wgpu = { path = "crates/bevy_wgpu", optional = true, version = "0.3.0" }
bevy_winit = { path = "crates/bevy_winit", optional = true, version = "0.3.0" }
bevy_gilrs = { path = "crates/bevy_gilrs", optional = true, version = "0.3.0" }

[dev-dependencies]
bevy = { path = "crates/bevy", version = "0.3.0" }
bevy_dylib = { path = "crates/bevy_dylib", version = "0.3.0" }
rand = "0.7.3"
serde = { version = "1", features = ["derive"] }
log = "0.4"
Expand Down
81 changes: 81 additions & 0 deletions crates/bevy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[package]
name = "bevy"
version = "0.3.0"
edition = "2018"
authors = [
"Bevy Contributors <[email protected]>",
"Carter Anderson <[email protected]>",
]
description = "A refreshingly simple data-driven game engine and app framework"
homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
license = "MIT"
keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
categories = ["game-engines", "graphics", "gui", "rendering"]
readme = "../../README.md"

[features]
default = [
"bevy_audio",
"bevy_dynamic_plugin",
"bevy_gilrs",
"bevy_gltf",
"bevy_wgpu",
"bevy_winit",
"render",
"png",
"hdr",
"mp3",
"x11",
]

profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"]
wgpu_trace = ["bevy_wgpu/trace"]

# 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"]

# Audio format support (MP3 is enabled by default)
mp3 = ["bevy_audio/mp3"]
flac = ["bevy_audio/flac"]
wav = ["bevy_audio/wav"]
vorbis = ["bevy_audio/vorbis"]

serialize = ["bevy_input/serialize"]

# Display server protocol support (X11 is enabled by default)
wayland = ["bevy_winit/wayland"]
x11 = ["bevy_winit/x11"]

[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.3.0" }
bevy_asset = { path = "../bevy_asset", version = "0.3.0" }
bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" }
bevy_core = { path = "../bevy_core", version = "0.3.0" }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.3.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.3.0" }
bevy_input = { path = "../bevy_input", version = "0.3.0" }
bevy_math = { path = "../bevy_math", version = "0.3.0" }
bevy_property = { path = "../bevy_property", version = "0.3.0" }
bevy_scene = { path = "../bevy_scene", version = "0.3.0" }
bevy_transform = { path = "../bevy_transform", version = "0.3.0" }
bevy_utils = { path = "../bevy_utils", version = "0.3.0" }
bevy_window = { path = "../bevy_window", version = "0.3.0" }
bevy_tasks = { path = "../bevy_tasks", version = "0.3.0" }
# bevy (optional)
bevy_audio = { path = "../bevy_audio", optional = true, version = "0.3.0" }
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.3.0" }
bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.3.0" }
bevy_render = { path = "../bevy_render", optional = true, version = "0.3.0" }
bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.3.0" }
bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.3.0" }
bevy_text = { path = "../bevy_text", optional = true, version = "0.3.0" }
bevy_ui = { path = "../bevy_ui", optional = true, version = "0.3.0" }
bevy_wgpu = { path = "../bevy_wgpu", optional = true, version = "0.3.0" }
bevy_winit = { path = "../bevy_winit", optional = true, version = "0.3.0" }
bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.3.0" }

File renamed without changes.
174 changes: 174 additions & 0 deletions crates/bevy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
//! [![](https://bevyengine.org/assets/bevy_logo_docs.svg)](https://bevyengine.org)
//!
//! Bevy is an open-source modular game engine built in Rust, with a focus on developer productivity and performance.
//!
//! Check out the [Bevy website](https://bevyengine.org) for more information, read the
//! [Bevy Book](https://bevyengine.org/learn/book/introduction) for a step-by-step guide, and [engage with our
//! community](https://bevyengine.org/community/) if you have any questions or ideas!
//!
//! ## Example
//!Here is a simple "Hello World" Bevy app:
//! ```
//!use bevy::prelude::*;
//!
//!fn main() {
//! App::build()
//! .add_system(hello_world_system.system())
//! .run();
//!}
//!
//!fn hello_world_system() {
//! println!("hello world");
//!}
//! ```
//! Don't let the simplicity of the example above fool you. Bevy is a [fully featured game engine](https://bevyengine.org)
//! and it gets more powerful every day!
//!
//! ### This Crate
//! The `bevy` crate is just a container crate that makes it easier to consume Bevy components.
//! The defaults provide a "full" engine experience, but you can easily enable / disable features
//! in your project's `Cargo.toml` to meet your specific needs. See Bevy's `Cargo.toml` for a full list of features available.
//!
//! If you prefer, you can also consume the individual bevy crates directly.
//! Each module in the root of this crate, except for the prelude, can be found on crates.io
//! with `bevy_` appended to the front, e.g. `app` -> [`bevy_app`](https://docs.rs/bevy_app/*/bevy_app/).
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
html_favicon_url = "https://bevyengine.org/assets/icon.png"
)]

/// `use bevy::prelude::*;` to import common components, bundles, and plugins.
pub mod prelude;

mod default_plugins;
pub use default_plugins::*;

pub mod app {
//! Build bevy apps, create plugins, and read events.
pub use bevy_app::*;
}

pub mod asset {
//! Load and store assets and resources for Apps.
pub use bevy_asset::*;
}

pub mod core {
//! Contains core plugins and utilities for time.
pub use bevy_core::*;
}

pub mod diagnostic {
//! Useful diagnostic plugins and types for bevy apps.
pub use bevy_diagnostic::*;
}

pub mod ecs {
//! Bevy's entity-component-system.
pub use bevy_ecs::*;
}

pub mod input {
//! Resources and events for inputs, e.g. mouse/keyboard, touch, gamepads, etc.
pub use bevy_input::*;
}

pub mod math {
//! Math types (Vec3, Mat4, Quat, etc) and helpers.
pub use bevy_math::*;
}

pub mod property {
//! Dynamically interact with struct fields and names.
pub use bevy_property::*;
}

pub mod scene {
//! Save/load collections of entities and components to/from file.
pub use bevy_scene::*;
}

pub mod tasks {
//! Pools for async, IO, and compute tasks.
pub use bevy_tasks::*;
}

pub mod transform {
//! Local and global transforms (e.g. translation, scale, rotation).
pub use bevy_transform::*;
}

pub mod type_registry {
//! Registered types and components can be used when loading scenes.
pub use bevy_type_registry::*;
}

pub mod utils {
pub use bevy_utils::*;
}

pub mod window {
//! Configuration, creation, and management of one or more windows.
pub use bevy_window::*;
}

#[cfg(feature = "bevy_audio")]
pub mod audio {
//! Provides types and plugins for audio playback.
pub use bevy_audio::*;
}

#[cfg(feature = "bevy_gltf")]
pub mod gltf {
//! Support for GLTF file loading.
pub use bevy_gltf::*;
}

#[cfg(feature = "bevy_pbr")]
pub mod pbr {
//! Physically based rendering.
//! **Note**: true PBR has not yet been implemented; the name `pbr` is aspirational.
pub use bevy_pbr::*;
}

#[cfg(feature = "bevy_render")]
pub mod render {
//! Cameras, meshes, textures, shaders, and pipelines.
pub use bevy_render::*;
}

#[cfg(feature = "bevy_sprite")]
pub mod sprite {
//! Items for sprites, rects, texture atlases, etc.
pub use bevy_sprite::*;
}

#[cfg(feature = "bevy_text")]
pub mod text {
//! Text drawing, styling, and font assets.
pub use bevy_text::*;
}

#[cfg(feature = "bevy_ui")]
pub mod ui {
//! User interface components and widgets.
pub use bevy_ui::*;
}

#[cfg(feature = "bevy_winit")]
pub mod winit {
pub use bevy_winit::*;
}

#[cfg(feature = "bevy_wgpu")]
pub mod wgpu {
//! A render backend utilizing [wgpu](https://github.com/gfx-rs/wgpu-rs).
pub use bevy_wgpu::*;
}

#[cfg(feature = "bevy_dynamic_plugin")]
pub mod dynamic_plugin {
pub use bevy_dynamic_plugin::*;
}
File renamed without changes.
19 changes: 19 additions & 0 deletions crates/bevy_dylib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "bevy_dylib"
version = "0.3.0"
edition = "2018"
authors = [
"Bevy Contributors <[email protected]>",
"Carter Anderson <[email protected]>",
]
description = "Force the Bevy Engine to be dynamically linked for faster linking"
homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
license = "MIT"
keywords = ["bevy"]

[lib]
crate-type = ["dylib"]

[dependencies]
bevy = { path = "../bevy", version = "0.3.0", default-features = false }
5 changes: 5 additions & 0 deletions crates/bevy_dylib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! Forces dynamic linking of Bevy
// Force linking of the main bevy crate
#[allow(unused_imports)]
use bevy;
2 changes: 2 additions & 0 deletions examples/2d/sprite.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use bevy::prelude::*;
#[allow(unused_imports)]
use bevy_dylib;

fn main() {
App::build()
Expand Down
2 changes: 2 additions & 0 deletions examples/2d/sprite_sheet.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use bevy::prelude::*;
#[allow(unused_imports)]
use bevy_dylib;

fn main() {
App::build()
Expand Down
2 changes: 2 additions & 0 deletions examples/2d/texture_atlas.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use bevy::{asset::LoadState, prelude::*, sprite::TextureAtlasBuilder};
#[allow(unused_imports)]
use bevy_dylib;

/// In this example we generate a new texture atlas (sprite sheet) from a folder containing individual sprites
fn main() {
Expand Down
Loading

0 comments on commit a1a3750

Please sign in to comment.