|
| 1 | +#![warn(missing_docs)] |
1 | 2 | #![allow(clippy::single_component_path_imports)]
|
2 | 3 |
|
3 | 4 | //! Forces dynamic linking of Bevy.
|
4 | 5 | //!
|
5 |
| -//! Dynamically linking Bevy makes the "link" step much faster. This can be achieved by adding |
6 |
| -//! `bevy_dylib` as dependency and `#[allow(unused_imports)] use bevy_dylib` to `main.rs`. It is |
7 |
| -//! recommended to disable the `bevy_dylib` dependency in release mode by adding |
8 |
| -//! `#[cfg(debug_assertions)]` to the `use` statement. Otherwise you will have to ship `libstd.so` |
9 |
| -//! and `libbevy_dylib.so` with your game. |
| 6 | +//! Dynamic linking causes Bevy to be built and linked as a dynamic library. This will make |
| 7 | +//! incremental builds compile much faster. |
| 8 | +//! |
| 9 | +//! # Warning |
| 10 | +//! |
| 11 | +//! Do not enable this feature for release builds because this would require you to ship |
| 12 | +//! `libstd.so` and `libbevy_dylib.so` with your game. |
| 13 | +//! |
| 14 | +//! # Enabling dynamic linking |
| 15 | +//! |
| 16 | +//! ## The recommended way |
| 17 | +//! |
| 18 | +//! The easiest way to enable dynamic linking is to use the `--features bevy/dynamic` flag when |
| 19 | +//! using the `cargo run` command: |
| 20 | +//! |
| 21 | +//! `cargo run --features bevy/dynamic` |
| 22 | +//! |
| 23 | +//! ## The unrecommended way |
| 24 | +//! |
| 25 | +//! It is also possible to enable the `dynamic` feature inside of the `Cargo.toml` file. This is |
| 26 | +//! unrecommended because it requires you to remove this feature every time you want to create a |
| 27 | +//! release build to avoid having to ship additional files with your game. |
| 28 | +//! |
| 29 | +//! To enable dynamic linking inside of the `Cargo.toml` file add the `dynamic` feature to the |
| 30 | +//! bevy dependency: |
| 31 | +//! |
| 32 | +//! `features = ["dynamic"]` |
| 33 | +//! |
| 34 | +//! ## The manual way |
| 35 | +//! |
| 36 | +//! Manually enabling dynamic linking is achieved by adding `bevy_dylib` as a dependency and |
| 37 | +//! adding the following code to the `main.rs` file: |
| 38 | +//! |
| 39 | +//! ```rust |
| 40 | +//! #[allow(unused_imports)] |
| 41 | +//! use bevy_dylib; |
| 42 | +//! ``` |
| 43 | +//! |
| 44 | +//! It is recommended to disable the `bevy_dylib` dependency in release mode by adding the |
| 45 | +//! following code to the `use` statement to avoid having to ship additional files with your game: |
| 46 | +//! |
| 47 | +//! ```rust |
| 48 | +//! #[allow(unused_imports)] |
| 49 | +//! #[cfg(debug_assertions)] // new |
| 50 | +//! use bevy_dylib; |
| 51 | +//! ``` |
10 | 52 |
|
11 | 53 | // Force linking of the main bevy crate
|
12 | 54 | #[allow(unused_imports)]
|
|
0 commit comments