Files
libloot/cpp/build.rs
T
Oliver Hamlet 83d9420422 Rename cxx directory to cpp
Also update the crate name and references to it. This helps distinguish the C++ wrapper that's built using CXX from CXX itself.
2025-04-29 17:42:46 +01:00

21 lines
729 B
Rust

fn main() {
cxx_build::bridge("src/lib.rs")
.std("c++17")
.flag_if_supported("/Zc:__cplusplus")
.flag_if_supported("/permissive-")
.compile("libloot-cpp");
// 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");
}
}
}