Skip to content

Commit

Permalink
Merge pull request #23 from Sympatron/short-enums
Browse files Browse the repository at this point in the history
Make sure cc and bindgen use the same size for enums
  • Loading branch information
sidcha authored Oct 31, 2024
2 parents ac83e92 + 7e57976 commit 6ffd7bc
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 6ffd7bc

Please sign in to comment.