Skip to content

Commit

Permalink
Make sure cc and bindgen use the same size for enums
Browse files Browse the repository at this point in the history
  • Loading branch information
Sympatron committed Oct 30, 2024
1 parent 2e486e5 commit 7e57976
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libosdp-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,20 @@ fn main() -> Result<()> {
.file("vendor/src/osdp_pcap.c");
}

let short_enums = build.get_compiler().is_like_gnu() || build.get_compiler().is_like_clang();
if short_enums {
build.flag("-fshort-enums");
}
build.compile("libosdp.a");

/* generate bindings */

let args = vec![format!("-I{}", &out_dir)];
let mut args = vec![format!("-I{}", &out_dir)];
if short_enums {
args.push("-fshort-enums".to_owned());
} else {
args.push("-fno-short-enums".to_owned());
}
let bindings = bindgen::Builder::default()
.use_core()
.header("vendor/include/osdp.h")
Expand Down

0 comments on commit 7e57976

Please sign in to comment.