Skip to content

Commit 38691ee

Browse files
committed
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 <[email protected]>
1 parent 5f18033 commit 38691ee

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ default = [
4848
]
4949

5050
# Force dynamic linking, which improves iterative compile times
51-
dynamic = ["bevy_dylib"]
51+
dynamic = ["bevy_dylib", "bevy_internal/dynamic"]
5252

5353
# Optional bevy crates
5454
bevy_animation = ["bevy_internal/bevy_animation"]

crates/bevy_diagnostic/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ repository = "https://github.com/bevyengine/bevy"
88
license = "MIT OR Apache-2.0"
99
keywords = ["bevy"]
1010

11+
[features]
12+
# Disables diagnostics that are unsupported when Bevy is dynamically linked
13+
dynamic = []
1114

1215
[dependencies]
1316
# bevy

crates/bevy_diagnostic/src/system_information_diagnostics_plugin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl SystemInformationDiagnosticsPlugin {
3434
target_os = "android",
3535
target_os = "macos"
3636
),
37-
not(feature = "bevy_dynamic_plugin")
37+
not(feature = "dynamic")
3838
))]
3939
pub mod internal {
4040
use bevy_ecs::{prelude::ResMut, system::Local};
@@ -142,7 +142,7 @@ pub mod internal {
142142
target_os = "android",
143143
target_os = "macos"
144144
),
145-
not(feature = "bevy_dynamic_plugin")
145+
not(feature = "dynamic")
146146
)))]
147147
pub mod internal {
148148
pub(crate) fn setup_system() {

crates/bevy_internal/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ bevy_ci_testing = ["bevy_app/bevy_ci_testing", "bevy_render/ci_limits"]
7171
# Enable animation support, and glTF animation loading
7272
animation = ["bevy_animation", "bevy_gltf?/bevy_animation"]
7373

74+
# Used to disable code that is unsupported when Bevy is dynamically linked
75+
dynamic = ["bevy_diagnostic/dynamic"]
76+
7477
[dependencies]
7578
# bevy
7679
bevy_app = { path = "../bevy_app", version = "0.9.0" }

0 commit comments

Comments
 (0)