use std::env;
use cc;
fn main() {
let mut cco = cc::Build::new();
cco.cpp(true).std("c++20");
if cfg!(target_os = "windows") {
env::set_var("VSLANG", "1033");
cco.flag("/EHsc").flag("/utf-8")
.flag("/D_CRT_SECURE_NO_WARNINGS")
.flag("/D_CRT_NONSTDC_NO_WARNINGS")
.flag("/DUNICODE")
.flag("/D_UNICODE");
} else {
cco.flag("-Wno-unused-parameter").flag("-Wno-unused-result").flag("-g");
}
cco.file("src/bridge.cpp").compile("dxcpp");
println!("cargo:rerun-if-changed=src/bridge.cpp");
#[cfg(target_os = "macos")]
if env::var("PROFILE").unwrap_or_default() == "debug" {
if let Ok(home) = env::var("HOME") {
let mut rpath = std::path::PathBuf::from(home);
rpath.push(".rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib");
if rpath.exists() {
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", rpath.display());
}
}
}
}