1 use cfg_aliases::cfg_aliases;
2
main()3 fn main() {
4 cfg_aliases! {
5 android: { target_os = "android" },
6 dragonfly: { target_os = "dragonfly" },
7 ios: { target_os = "ios" },
8 freebsd: { target_os = "freebsd" },
9 illumos: { target_os = "illumos" },
10 linux: { target_os = "linux" },
11 macos: { target_os = "macos" },
12 netbsd: { target_os = "netbsd" },
13 openbsd: { target_os = "openbsd" },
14 solaris: { target_os = "solaris" },
15 watchos: { target_os = "watchos" },
16 tvos: { target_os = "tvos" },
17 visionos: { target_os = "visionos" },
18
19
20 // cfg aliases we would like to use
21 apple_targets: { any(ios, macos, watchos, tvos, visionos) },
22 bsd: { any(freebsd, dragonfly, netbsd, openbsd, apple_targets) },
23 bsd_without_apple: { any(freebsd, dragonfly, netbsd, openbsd) },
24 linux_android: { any(android, linux) },
25 freebsdlike: { any(dragonfly, freebsd) },
26 netbsdlike: { any(netbsd, openbsd) },
27 solarish: { any(illumos, solaris) },
28 }
29
30 // Below are Nix's custom cfg values that we need to let the compiler know
31 println!("cargo:rustc-check-cfg=cfg(apple_targets)");
32 println!("cargo:rustc-check-cfg=cfg(bsd)");
33 println!("cargo:rustc-check-cfg=cfg(bsd_without_apple)");
34 println!("cargo:rustc-check-cfg=cfg(linux_android)");
35 println!("cargo:rustc-check-cfg=cfg(freebsdlike)");
36 println!("cargo:rustc-check-cfg=cfg(netbsdlike)");
37 println!("cargo:rustc-check-cfg=cfg(solarish)");
38 println!("cargo:rustc-check-cfg=cfg(fbsd14)");
39 println!("cargo:rustc-check-cfg=cfg(qemu)");
40 }
41