From d1d4d59321f013796dd7e5e3b313f7701225e111 Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Fri, 10 Apr 2020 20:41:29 +0200 Subject: [PATCH] Leave lib.rs as container of tests --- .gitignore | 1 - lvgl-sys/build.rs | 4 ++-- lvgl-sys/src/lib.rs | 5 +++++ 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 lvgl-sys/src/lib.rs diff --git a/.gitignore b/.gitignore index 4762946..aa982cd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk .idea/ -lvgl-sys/src/lib.rs diff --git a/lvgl-sys/build.rs b/lvgl-sys/build.rs index 661d470..07abd79 100644 --- a/lvgl-sys/build.rs +++ b/lvgl-sys/build.rs @@ -29,14 +29,14 @@ fn main() { .include(&lvgl_config_path) .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()]; 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") - .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!"); } diff --git a/lvgl-sys/src/lib.rs b/lvgl-sys/src/lib.rs new file mode 100644 index 0000000..bd0b4ed --- /dev/null +++ b/lvgl-sys/src/lib.rs @@ -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"));