Files
libloot/cpp/build.rs
Oliver Hamlet 4ffd62572d Use C++20 in the C++ wrapper
This commit mostly just fixes compilation errors when compiling in C++20 mode, though the change to std::filesystem::path::u8string()'s return type means it's not backwards-compatible with C++17.
2025-06-11 22:13:46 +01:00

21 lines
729 B
Rust

fn main() {
cxx_build::bridge("src/lib.rs")
.std("c++20")
.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");
}
}
}