diff --git a/lvgl-sys/Cargo.toml b/lvgl-sys/Cargo.toml index 46b07b2..d59a3bc 100644 --- a/lvgl-sys/Cargo.toml +++ b/lvgl-sys/Cargo.toml @@ -22,3 +22,6 @@ cty = "0.2.1" [build-dependencies] cc = "1.0.68" bindgen = "0.59.2" + +[features] +use-vendored-config = [] diff --git a/lvgl-sys/build.rs b/lvgl-sys/build.rs index dfaef3c..c427ed1 100644 --- a/lvgl-sys/build.rs +++ b/lvgl-sys/build.rs @@ -19,10 +19,16 @@ fn main() { // so let's use the vendored `lv_conf.h` file. vendor.join("include") } - Err(_) => panic!( - "The environment variable {} is required to be defined", - CONFIG_NAME - ), + Err(_) => { + #[cfg(not(feature = "use-vendored-config"))] + panic!( + "The environment variable {} is required to be defined", + CONFIG_NAME + ); + + #[cfg(feature = "use-vendored-config")] + vendor.join("include") + } } }); diff --git a/lvgl/Cargo.toml b/lvgl/Cargo.toml index 3ad7700..72acd96 100644 --- a/lvgl/Cargo.toml +++ b/lvgl/Cargo.toml @@ -21,6 +21,7 @@ bitflags = "1.2.1" [features] alloc = ["cstr_core/alloc"] lvgl_alloc = ["alloc"] +use-vendored-config = ["lvgl-sys/use-vendored-config"] [build-dependencies] quote = "1.0.9"