Set /std:c11 ccflag for Windows in Rust bindings (#354)

This commit is contained in:
Justin Traglia 2023-08-31 14:12:02 -05:00 committed by GitHub
parent 666a9de002
commit d35b0f3854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -43,8 +43,3 @@ glob = "0.3"
[[bench]]
name = "kzg_benches"
harness = false
# The benchmarks crash on Windows with Rust 1.70. This is a band-aid fix for
# that. Refer to #318 for more details. This should be removed if fixed.
[profile.bench]
opt-level = 0

View File

@ -30,7 +30,15 @@ fn main() {
let mut cc = cc::Build::new();
#[cfg(windows)]
cc.flag("-D_CRT_SECURE_NO_WARNINGS");
{
cc.flag("-D_CRT_SECURE_NO_WARNINGS");
// In blst, if __STDC_VERSION__ isn't defined as c99 or greater, it will typedef a bool to
// an int. There is a bug in bindgen associated with this. It assumes that a bool in C is
// the same size as a bool in Rust. This is the root cause of the issues on Windows. If/when
// this is fixed in bindgen, it should be safe to remove this compiler flag.
cc.flag("/std:c11");
}
cc.include(blst_headers_dir.clone());
cc.warnings(false);