Fix dynamic linking (on linux) (#7333)

# Problemo

Some code in #5911 and #5454 does not compile with dynamic linking enabled.
The code is behind a feature gate to prevent dynamically linked builds from breaking, but it's not quite set up correctly.

## Solution

Forward the `dynamic` feature flag to the `bevy_diagnostic` crate and gate the code behind it.


Co-authored-by: devil-ira <justthecooldude@gmail.com>
This commit is contained in:
ira 2023-01-22 20:41:28 +00:00
parent 5f18033dd3
commit 38691ee95c
4 changed files with 9 additions and 3 deletions

View file

@ -48,7 +48,7 @@ default = [
]
# Force dynamic linking, which improves iterative compile times
dynamic = ["bevy_dylib"]
dynamic = ["bevy_dylib", "bevy_internal/dynamic"]
# Optional bevy crates
bevy_animation = ["bevy_internal/bevy_animation"]

View file

@ -8,6 +8,9 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy"]
[features]
# Disables diagnostics that are unsupported when Bevy is dynamically linked
dynamic = []
[dependencies]
# bevy

View file

@ -34,7 +34,7 @@ impl SystemInformationDiagnosticsPlugin {
target_os = "android",
target_os = "macos"
),
not(feature = "bevy_dynamic_plugin")
not(feature = "dynamic")
))]
pub mod internal {
use bevy_ecs::{prelude::ResMut, system::Local};
@ -142,7 +142,7 @@ pub mod internal {
target_os = "android",
target_os = "macos"
),
not(feature = "bevy_dynamic_plugin")
not(feature = "dynamic")
)))]
pub mod internal {
pub(crate) fn setup_system() {

View file

@ -71,6 +71,9 @@ bevy_ci_testing = ["bevy_app/bevy_ci_testing", "bevy_render/ci_limits"]
# Enable animation support, and glTF animation loading
animation = ["bevy_animation", "bevy_gltf?/bevy_animation"]
# Used to disable code that is unsupported when Bevy is dynamically linked
dynamic = ["bevy_diagnostic/dynamic"]
[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.9.0" }