Build script generates correct lib.rs bindings

This commit is contained in:
Rafael Caricio 2020-04-10 19:48:21 +02:00
parent 6da7ca0c19
commit b826993893

View file

@ -18,15 +18,17 @@ fn main() {
cfg.file(src.parent().unwrap().join("lvgl.h"))
.define("LV_CONF_INCLUDE_SIMPLE", Some("1"))
.include(&src)
.warnings(false);
cfg.include(&lvgl_config_path);
cfg.compile("lvgl");
.warnings(false)
.include(&lvgl_config_path)
.compile("lvgl");
let cc_args = ["-DLV_CONF_INCLUDE_SIMPLE=1", "-I", lvgl_config_path.to_str().unwrap()];
let _bindings = bindgen::Builder::default()
bindgen::Builder::default()
.header(src.parent().unwrap().join("lvgl.h").to_str().unwrap())
.raw_line("#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]")
.clang_args(&cc_args)
.generate().expect("Unable to generate bindings");
.generate()
.expect("Unable to generate bindings")
.write_to_file(root_dir.join("lvgl-sys").join("src").join("lib.rs"))
.expect("Can't write bindings!");
}