Skip to content

Commit 2b10b4b

Browse files
committed
support extra check-cfg
1 parent 6c87d7c commit 2b10b4b

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
@@ -28,6 +28,13 @@ const ALLOWED_CFGS: &[&str] = &[
2828
"libc_union",
2929
];
3030

31+
// Extra values to allow for check-cfg.
32+
const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
33+
("target_os", &["switch"]),
34+
("target_env", &["illumos", "wasi"]),
35+
("target_arch", &["loongarch64"]),
36+
];
37+
3138
fn main() {
3239
// Avoid unnecessary re-building.
3340
println!("cargo:rerun-if-changed=build.rs");
@@ -148,6 +155,10 @@ fn main() {
148155
for cfg in ALLOWED_CFGS {
149156
println!("cargo:rustc-check-cfg=values({})", cfg);
150157
}
158+
for (name, values) in CHECK_CFG_EXTRA {
159+
let values = values.join("\",\"");
160+
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
161+
}
151162
}
152163
}
153164

0 commit comments

Comments
 (0)