Leave lib.rs as container of tests

This commit is contained in:
Rafael Caricio 2020-04-10 20:41:29 +02:00
parent afdb7edd92
commit d1d4d59321
3 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View file

@ -9,4 +9,3 @@ Cargo.lock
# These are backup files generated by rustfmt # These are backup files generated by rustfmt
**/*.rs.bk **/*.rs.bk
.idea/ .idea/
lvgl-sys/src/lib.rs

View file

@ -29,14 +29,14 @@ fn main() {
.include(&lvgl_config_path) .include(&lvgl_config_path)
.compile("lvgl"); .compile("lvgl");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let cc_args = ["-DLV_CONF_INCLUDE_SIMPLE=1", "-I", lvgl_config_path.to_str().unwrap()]; let cc_args = ["-DLV_CONF_INCLUDE_SIMPLE=1", "-I", lvgl_config_path.to_str().unwrap()];
bindgen::Builder::default() bindgen::Builder::default()
.header(src.parent().unwrap().join("lvgl.h").to_str().unwrap()) .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) .clang_args(&cc_args)
.generate() .generate()
.expect("Unable to generate bindings") .expect("Unable to generate bindings")
.write_to_file(root_dir.join("lvgl-sys").join("src").join("lib.rs")) .write_to_file(out_path.join("bindings.rs"))
.expect("Can't write bindings!"); .expect("Can't write bindings!");
} }

5
lvgl-sys/src/lib.rs Normal file
View file

@ -0,0 +1,5 @@
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));