mirror of
https://github.com/bevyengine/bevy
synced 2025-01-09 19:58:58 +00:00
72c51cdab9
# Objective - In #12366 `![cfg_attr(docsrs, feature(doc_auto_cfg))] `was added. But to apply it it needs `--cfg=docsrs` in rustdoc-args. ## Solution - Apply `--cfg=docsrs` to all crates and CI. I also added `[package.metadata.docs.rs]` to all crates to avoid adding code behind a feature and forget adding the metadata. Before: ![Screenshot 2024-03-22 at 00 51 57](https://github.com/bevyengine/bevy/assets/104745335/6a9dfdaa-8710-4784-852b-5f9b74e3522c) After: ![Screenshot 2024-03-22 at 00 51 32](https://github.com/bevyengine/bevy/assets/104745335/c5bd6d8e-8ddb-45b3-b844-5ecf9f88961c)
55 lines
1.8 KiB
Rust
55 lines
1.8 KiB
Rust
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
|
|
|
//! Forces dynamic linking of Bevy.
|
|
//!
|
|
//! Dynamic linking causes Bevy to be built and linked as a dynamic library. This will make
|
|
//! incremental builds compile much faster.
|
|
//!
|
|
//! # Warning
|
|
//!
|
|
//! Do not enable this feature for release builds because this would require you to ship
|
|
//! `libstd.so` and `libbevy_dylib.so` with your game.
|
|
//!
|
|
//! # Enabling dynamic linking
|
|
//!
|
|
//! ## The recommended way
|
|
//!
|
|
//! The easiest way to enable dynamic linking is to use the `--features bevy/dynamic_linking` flag when
|
|
//! using the `cargo run` command:
|
|
//!
|
|
//! `cargo run --features bevy/dynamic_linking`
|
|
//!
|
|
//! ## The unrecommended way
|
|
//!
|
|
//! It is also possible to enable the `dynamic_linking` feature inside of the `Cargo.toml` file. This is
|
|
//! unrecommended because it requires you to remove this feature every time you want to create a
|
|
//! release build to avoid having to ship additional files with your game.
|
|
//!
|
|
//! To enable dynamic linking inside of the `Cargo.toml` file add the `dynamic_linking` feature to the
|
|
//! bevy dependency:
|
|
//!
|
|
//! `features = ["dynamic_linking"]`
|
|
//!
|
|
//! ## The manual way
|
|
//!
|
|
//! Manually enabling dynamic linking is achieved by adding `bevy_dylib` as a dependency and
|
|
//! adding the following code to the `main.rs` file:
|
|
//!
|
|
//! ```
|
|
//! #[allow(unused_imports)]
|
|
//! use bevy_dylib;
|
|
//! ```
|
|
//!
|
|
//! It is recommended to disable the `bevy_dylib` dependency in release mode by adding the
|
|
//! following code to the `use` statement to avoid having to ship additional files with your game:
|
|
//!
|
|
//! ```
|
|
//! #[allow(unused_imports)]
|
|
//! #[cfg(debug_assertions)] // new
|
|
//! use bevy_dylib;
|
|
//! ```
|
|
|
|
// Force linking of the main bevy crate
|
|
#[allow(unused_imports)]
|
|
#[allow(clippy::single_component_path_imports)]
|
|
use bevy_internal;
|