fix: feature gates

This commit is contained in:
Ashley Wulber 2026-07-15 12:34:42 -04:00 • committed by Ashley Wulber
parent f6daee14ac
commit b3b0ab1cd5
26 changed files with 176 additions and 101 deletions

17
build_helpers/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "build_helpers"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
categories.workspace = true
keywords.workspace = true
rust-version.workspace = true
[dependencies]
cfg_aliases = { version = "0.2.1" }
[lints]
workspace = true

23
build_helpers/src/lib.rs Normal file
View file

@ -0,0 +1,23 @@
use cfg_aliases::cfg_aliases;
pub fn cfg_aliases_setup() {
// The script doesn't depend on our code
println!("cargo:rerun-if-changed=build.rs");
// Setup cfg aliases
cfg_aliases! {
// Systems.
android_platform: { target_os = "android" },
wasm_platform: { all(target_family = "wasm", not(target_os = "emscripten")) },
macos_platform: { target_os = "macos" },
ios_platform: { target_os = "ios" },
windows_platform: { target_os = "windows" },
apple: { any(target_os = "ios", target_os = "macos") },
free_unix: { all(unix, not(apple), not(android_platform), not(target_os = "emscripten")) },
redox: { target_os = "redox" },
// Native displays.
wayland_platform: { all(feature = "wayland", free_unix, not(wasm), not(redox)) },
orbital_platform: { redox },
}
}