diff --git a/.gitmodules b/.gitmodules index 80e4d39..2e11aa5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/lvgl-sys/build.rs b/lvgl-sys/build.rs index 2821faf..a48ac3f 100644 --- a/lvgl-sys/build.rs +++ b/lvgl-sys/build.rs @@ -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!"); } diff --git a/vendor/lv_sim_eclipse_sdl b/lvgl-sys/vendor/lv_sim_eclipse_sdl similarity index 100% rename from vendor/lv_sim_eclipse_sdl rename to lvgl-sys/vendor/lv_sim_eclipse_sdl diff --git a/vendor/lvgl b/lvgl-sys/vendor/lvgl similarity index 100% rename from vendor/lvgl rename to lvgl-sys/vendor/lvgl