Fix packaging with vendor location

This commit is contained in:
Rafael Caricio 2020-04-12 13:41:36 +02:00
parent 8da0d9ee80
commit e68275a7c8
4 changed files with 20 additions and 19 deletions

10
.gitmodules vendored
View file

@ -1,6 +1,6 @@
[submodule "vendor/lvgl"]
path = vendor/lvgl
url = https://github.com/littlevgl/lvgl.git
[submodule "vendor/lv_sim_eclipse_sdl"]
path = vendor/lv_sim_eclipse_sdl
[submodule "lvgl-sys/vendor/lv_sim_eclipse_sdl"]
path = lvgl-sys/vendor/lv_sim_eclipse_sdl
url = https://github.com/rafaelcaricio/lv_sim_eclipse_sdl.git
[submodule "lvgl-sys/vendor/lvgl"]
path = lvgl-sys/vendor/lvgl
url = https://github.com/littlevgl/lvgl.git

View file

@ -6,26 +6,25 @@ fn main() {
let project_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.canonicalize()
.unwrap();
let root_dir = project_dir.parent().unwrap();
let vendor = root_dir.join("vendor");
let lvgl_sys_src = root_dir.join("lvgl-sys").join("src");
let src = vendor.join("lvgl").join("src");
let vendor = project_dir.join("vendor");
let vendor_src = vendor.join("lvgl").join("src");
// TODO: Make it configurable! Needs to be linked to final proj defs, define as an env var.
let lvgl_config_path = vendor.join("lv_sim_eclipse_sdl");
let mut cfg = Build::new();
add_c_files(&mut cfg, src.join("lv_core"));
add_c_files(&mut cfg, src.join("lv_draw"));
add_c_files(&mut cfg, src.join("lv_font"));
add_c_files(&mut cfg, src.join("lv_hal"));
add_c_files(&mut cfg, src.join("lv_misc"));
add_c_files(&mut cfg, src.join("lv_objx"));
add_c_files(&mut cfg, src.join("lv_themes"));
add_c_files(&mut cfg, vendor_src.join("lv_core"));
add_c_files(&mut cfg, vendor_src.join("lv_draw"));
add_c_files(&mut cfg, vendor_src.join("lv_font"));
add_c_files(&mut cfg, vendor_src.join("lv_hal"));
add_c_files(&mut cfg, vendor_src.join("lv_misc"));
add_c_files(&mut cfg, vendor_src.join("lv_objx"));
add_c_files(&mut cfg, vendor_src.join("lv_themes"));
cfg.define("LV_CONF_INCLUDE_SIMPLE", Some("1"))
.include(&src)
.include(&vendor_src)
.include(&vendor)
.warnings(false)
.include(&lvgl_config_path)
.compile("lvgl");
@ -34,9 +33,11 @@ fn main() {
"-DLV_CONF_INCLUDE_SIMPLE=1",
"-I",
lvgl_config_path.to_str().unwrap(),
"-I",
vendor.to_str().unwrap()
];
bindgen::Builder::default()
.header(src.parent().unwrap().join("lvgl.h").to_str().unwrap())
.header(vendor_src.parent().unwrap().join("lvgl.h").to_str().unwrap())
.layout_tests(false)
.use_core()
.ctypes_prefix("cty")
@ -44,7 +45,7 @@ fn main() {
.clang_args(&cc_args)
.generate()
.expect("Unable to generate bindings")
.write_to_file(lvgl_sys_src.join("bindings.rs"))
.write_to_file(project_dir.join("src").join("bindings.rs"))
.expect("Can't write bindings!");
}

View file