()
| 1 | fn main() { |
| 2 | let files = [ |
| 3 | "native_hooks.c", |
| 4 | "timer.c", |
| 5 | "interrupt_triggers.c", |
| 6 | "util.c", |
| 7 | "core_peripherals/cortexm_nvic.c", |
| 8 | "core_peripherals/cortexm_systick.c", |
| 9 | ]; |
| 10 | let base_path = std::path::Path::new("./fuzzware-native/"); |
| 11 | |
| 12 | cc::Build::new() |
| 13 | .include(base_path) |
| 14 | .files(files.iter().map(|file| base_path.join(file))) |
| 15 | .flag_if_supported("-Wno-unused-parameter") |
| 16 | .flag_if_supported("-Wno-sign-compare") |
| 17 | .flag_if_supported("-Wno-type-limits") |
| 18 | .compile("fuzzware-native"); |
| 19 | |
| 20 | for file in files { |
| 21 | println!("cargo:rerun-if-changed=./fuzzware-native/{file}"); |
| 22 | } |
| 23 | |
| 24 | let wrapper_header = "./fuzzware-native/wrapper.h"; |
| 25 | println!("cargo:rerun-if-changed={wrapper_header}"); |
| 26 | |
| 27 | let bindings = bindgen::builder() |
| 28 | .header(wrapper_header) |
| 29 | .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) |
| 30 | .size_t_is_usize(true) |
| 31 | .layout_tests(false) |
| 32 | .default_enum_style(bindgen::EnumVariation::ModuleConsts) |
| 33 | .translate_enum_integer_types(true) |
| 34 | .generate() |
| 35 | .expect("failed to generated bindings"); |
| 36 | |
| 37 | let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); |
| 38 | bindings |
| 39 | .write_to_file(out_path.join("fuzzware_bindings.rs")) |
| 40 | .expect("failed to write bindings"); |
| 41 | } |
nothing calls this directly
no outgoing calls
no test coverage detected