2025-03-06 22:24:39 +00:00
|
|
|
fn main() {
|
|
|
|
|
cxx_build::bridge("src/lib.rs")
|
|
|
|
|
.std("c++17")
|
2025-04-20 12:59:19 +01:00
|
|
|
.flag_if_supported("/Zc:__cplusplus")
|
|
|
|
|
.flag_if_supported("/permissive-")
|
2025-04-28 18:10:57 +01:00
|
|
|
.compile("libloot-cpp");
|
2025-03-06 22:24:39 +00:00
|
|
|
|
2025-03-25 19:33:53 +00:00
|
|
|
// From <https://github.com/dtolnay/cxx/issues/880#issuecomment-2521375384>
|
|
|
|
|
if std::env::var("TARGET").is_ok_and(|s| s.contains("windows-msvc")) {
|
|
|
|
|
// MSVC compiler suite
|
|
|
|
|
if std::env::var("CFLAGS").is_ok_and(|s| s.contains("/MDd")) {
|
|
|
|
|
// debug runtime flag is set
|
|
|
|
|
|
|
|
|
|
// Don't link the default CRT
|
|
|
|
|
println!("cargo::rustc-link-arg=/nodefaultlib:msvcrt");
|
|
|
|
|
// Link the debug CRT instead
|
|
|
|
|
println!("cargo::rustc-link-arg=/defaultlib:msvcrtd");
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-06 22:24:39 +00:00
|
|
|
}
|