Compare commits

...

3 commits

Author SHA1 Message Date
Rafael Caricio efda4647e2 Release 0.5.1 2021-03-06 23:37:10 +01:00
Rafael Caricio 5c8927d8d6 Disable lvgl original comments in bindings
We disable the comments generation here because some comments
cause the `cargo test` command to fail. Some of the original
comments have invalid tokens like `TYPEDEFS` causing issues.
We should recommend users to look the original comments in the
original lvgl in their C API docs.
2021-03-06 21:09:06 +01:00
Rafael Caricio 13641d0d97 Fix build in Docs.rs 2021-03-06 20:28:44 +01:00
5 changed files with 36 additions and 14 deletions

View file

@ -19,6 +19,20 @@ LittlevGL is compatible with <samp>#![no_std]</samp> environments by default.
![Rust bindings usage demo code.](demo.png) ![Rust bindings usage demo code.](demo.png)
## System Build Dependencies
In order to build the `lvgl` project you will need the following system dependencies to be installed:
```
$ sudo apt install build-essential llvm clang
```
If you want to build the examples, then you will need to install SDL2 as well.
```
$ sudo apt install libsdl2-dev
```
## Usage ## Usage
Edit your `Cargo.toml` file dependencies with: Edit your `Cargo.toml` file dependencies with:

View file

@ -1,7 +1,7 @@
[package] [package]
name = "lvgl-codegen" name = "lvgl-codegen"
version = "0.4.0" version = "0.5.1"
description = "Code generation based on LVGL source code" description = "Code1generation based on LVGL source code"
authors = ["Rafael Caricio <crates.lvgl@caric.io>"] authors = ["Rafael Caricio <crates.lvgl@caric.io>"]
readme = "README.md" readme = "README.md"
edition = "2018" edition = "2018"

View file

@ -1,7 +1,7 @@
[package] [package]
name = "lvgl-sys" name = "lvgl-sys"
description = "Raw bindings to the LittlevGL C library." description = "Raw bindings to the LittlevGL C library."
version = "0.4.0" version = "0.5.1"
authors = ["Rafael Caricio <crates.lvgl-sys@caric.io>"] authors = ["Rafael Caricio <crates.lvgl-sys@caric.io>"]
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"

View file

@ -12,17 +12,24 @@ fn main() {
let vendor_src = vendor.join("lvgl").join("src"); let vendor_src = vendor.join("lvgl").join("src");
let lv_config_dir = { let lv_config_dir = {
let raw_path = env::var(CONFIG_NAME).unwrap_or_else(|_| { let conf_path = env::var(CONFIG_NAME).map(|raw_path| PathBuf::from(raw_path)).unwrap_or_else(|_| {
panic!( match std::env::var("DOCS_RS") {
"The environment variable {} is required to be defined", Ok(_) => {
CONFIG_NAME // We've detected that we are building for docs.rs
); // so let's set the examples `lv_conf.h` file.
project_dir.join("..").join("examples").join("include")
}
Err(_) => panic!(
"The environment variable {} is required to be defined",
CONFIG_NAME
)
}
}); });
let conf_path = PathBuf::from(raw_path);
if !conf_path.exists() { if !conf_path.exists() {
panic!(format!( panic!(format!(
"Directory referenced by {} needs to exist", "Directory {} referenced by {} needs to exist",
conf_path.to_string_lossy(),
CONFIG_NAME CONFIG_NAME
)); ));
} }
@ -94,6 +101,7 @@ fn main() {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let bindings = bindgen::Builder::default() let bindings = bindgen::Builder::default()
.header(shims_dir.join("lvgl_sys.h").to_str().unwrap()) .header(shims_dir.join("lvgl_sys.h").to_str().unwrap())
.generate_comments(false)
.layout_tests(false) .layout_tests(false)
.use_core() .use_core()
.rustfmt_bindings(true) .rustfmt_bindings(true)

View file

@ -1,7 +1,7 @@
[package] [package]
name = "lvgl" name = "lvgl"
description = "LittlevGL bindings for Rust. A powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash)." description = "LittlevGL bindings for Rust. A powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash)."
version = "0.4.0" version = "0.5.1"
authors = ["Rafael Caricio <crates.lvgl@caric.io>"] authors = ["Rafael Caricio <crates.lvgl@caric.io>"]
edition = "2018" edition = "2018"
repository = "https://github.com/rafaelcaricio/lvgl-rs" repository = "https://github.com/rafaelcaricio/lvgl-rs"
@ -12,7 +12,7 @@ keywords = ["littlevgl", "lvgl", "graphical_interfaces"]
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
lvgl-sys = { version = "0.4.0", path = "../lvgl-sys" } lvgl-sys = { version = "0.5.1", path = "../lvgl-sys" }
cty = "0.2.1" cty = "0.2.1"
embedded-graphics = "0.6.2" embedded-graphics = "0.6.2"
cstr_core = { version = "0.2.0" } cstr_core = { version = "0.2.0" }
@ -21,6 +21,6 @@ bitflags = "1.2.1"
[build-dependencies] [build-dependencies]
quote = "1.0.7" quote = "1.0.7"
proc-macro2 = "1.0.18" proc-macro2 = "1.0.18"
lvgl-codegen = { version = "0.4.0", path = "../lvgl-codegen" } lvgl-codegen = { version = "0.5.1", path = "../lvgl-codegen" }
lvgl-sys = { version = "0.4.0", path = "../lvgl-sys" } lvgl-sys = { version = "0.5.1", path = "../lvgl-sys" }