Skip to content

Commit

Permalink
support extra check-cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Mar 6, 2023
1 parent b636da0 commit e74f735
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ const ALLOWED_CFGS: &[&str] = &[
"libc_union",
];

// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
("target_os", &["switch", "aix", "ohos"]),
("target_env", &["illumos", "wasi", "aix", "ohos"]),
("target_arch", &["loongarch64"]),
];

fn main() {
// Avoid unnecessary re-building.
println!("cargo:rerun-if-changed=build.rs");
Expand Down Expand Up @@ -151,6 +158,10 @@ fn main() {
for cfg in ALLOWED_CFGS {
println!("cargo:rustc-check-cfg=values({})", cfg);
}
for (name, values) in CHECK_CFG_EXTRA {
let values = values.join("\",\"");
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
}
}
}

Expand Down

0 comments on commit e74f735

Please sign in to comment.