Skip to content

Commit db1f363

Browse files
committed
support extra check-cfg
1 parent 708352d commit db1f363

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ const ALLOWED_CFGS: &[&str] = &[
2929
"libc_union",
3030
];
3131

32+
// Extra values to allow for check-cfg.
33+
const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
34+
("target_os", &["switch", "aix"]),
35+
("target_env", &["illumos", "wasi", "aix"]),
36+
("target_arch", &["loongarch64"]),
37+
];
38+
3239
fn main() {
3340
// Avoid unnecessary re-building.
3441
println!("cargo:rerun-if-changed=build.rs");
@@ -154,6 +161,10 @@ fn main() {
154161
for cfg in ALLOWED_CFGS {
155162
println!("cargo:rustc-check-cfg=values({})", cfg);
156163
}
164+
for (name, values) in CHECK_CFG_EXTRA {
165+
let values = values.join("\",\"");
166+
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
167+
}
157168
}
158169
}
159170

0 commit comments

Comments
 (0)