build(uci): restrict UCI dependency and feature to Linux targets

Ensure the UCI integration is only compiled on Linux, as the underlying native dependency is platform-specific. Added a build script to warn users when the feature is enabled on unsupported platforms.
This commit is contained in:
Nils Andreas Svee committed 2026-07-17 01:43:10 +07:00
1 parent b56c8b72cc
commit c5d673fcb8
3 files changed
+23 -5

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
use std::env;
fn main() {
let uci_enabled = env::var_os("CARGO_FEATURE_UCI").is_some();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let target = env::var("TARGET").unwrap_or_else(|_| "unknown".into());
if uci_enabled && target_os != "linux" {
println!(
"cargo::warning=feature `uci` is unsupported for target `{target}`; \
UCI integration will not be compiled"
);
}
println!("cargo::rerun-if-changed=build.rs");
}