Use cfg aliases throught the code base

Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
Amr Bashir
2022-12-25 09:57:27 +02:00
committed by GitHub
parent 58ec458877
commit 5e77d70245
27 changed files with 185 additions and 227 deletions

21
build.rs Normal file
View File

@@ -0,0 +1,21 @@
use cfg_aliases::cfg_aliases;
fn main() {
// 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: { target_arch = "wasm32" },
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)) },
// Native displays.
x11_platform: { all(feature = "x11", free_unix, not(wasm)) },
wayland_platform: { all(feature = "wayland", free_unix, not(wasm)) },
}
}