Skip to content

Commit e74f735

Browse files
committed
support extra check-cfg
1 parent b636da0 commit e74f735

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

build.rs

+11
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", "ohos"]),
35+
("target_env", &["illumos", "wasi", "aix", "ohos"]),
36+
("target_arch", &["loongarch64"]),
37+
];
38+
3239
fn main() {
3340
// Avoid unnecessary re-building.
3441
println!("cargo:rerun-if-changed=build.rs");
@@ -151,6 +158,10 @@ fn main() {
151158
for cfg in ALLOWED_CFGS {
152159
println!("cargo:rustc-check-cfg=values({})", cfg);
153160
}
161+
for (name, values) in CHECK_CFG_EXTRA {
162+
let values = values.join("\",\"");
163+
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
164+
}
154165
}
155166
}
156167

0 commit comments

Comments
 (0)