Skip to content

Commit

Permalink
better cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSentry committed Dec 26, 2022
1 parent 63b60ea commit bb18ca0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 8 additions & 8 deletions crates/bevy_diagnostic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ bevy_log = { path = "../bevy_log", version = "0.9.0" }
bevy_time = { path = "../bevy_time", version = "0.9.0" }
bevy_utils = { path = "../bevy_utils", version = "0.9.0" }

# iOS or MacOS
[target.'cfg(any(target_os="ios",target_os="macos"))'.dependencies.sysinfo]
version = "0.27.1"
# MacOS
[target.'cfg(all(target_os="macos"))'.dependencies]
# Some features of sysinfo are not supported by apple. This will disable those features on apple devices
features = ["apple-app-store"]
default-features = false
sysinfo = { version = "0.27.1", default-features = false, features = [
"apple-app-store",
] }

[dependencies.sysinfo]
version = "0.27.1"
default-features = false
# Only include when not bevy_dynamic_plugin and on linux/windows/android
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "android"))'.dependencies]
sysinfo = { version = "0.27.1", default-features = false }
12 changes: 10 additions & 2 deletions crates/bevy_diagnostic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ struct SystemInfo {
const BYTES_TO_GIB: f64 = 1.0 / 1024.0 / 1024.0 / 1024.0;

fn log_system_info() {
// NOTE: sysinfo fails to compile when using bevy dynamic or on iOS
#[cfg(not(any(feature = "bevy_dynamic_plugin", target_os = "ios")))]
// NOTE: sysinfo fails to compile when using bevy dynamic or on iOS and does nothing on wasm
#[cfg(all(
any(
target_os = "linux",
target_os = "windows",
target_os = "android",
target_os = "macos"
),
not(feature = "bevy_dynamic_plugin")
))]
{
use sysinfo::{CpuExt, SystemExt};

Expand Down

0 comments on commit bb18ca0

Please sign in to comment.