From 0c044410dd3158ed2f2dc8f3eb934f6b1f668765 Mon Sep 17 00:00:00 2001 From: Jay Jackson Date: Tue, 17 May 2022 21:35:05 -0400 Subject: [PATCH] add use-vendored-config feature --- lvgl-sys/Cargo.toml | 3 +++ lvgl-sys/build.rs | 14 ++++++++++---- lvgl/Cargo.toml | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) 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" -- 2.34.1