Skip to content

A wrapper for the Light Versatile Graphic Library (LVGL)

License

Notifications You must be signed in to change notification settings

mantielero/lvgl.nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lvgl.nim

A wrapper of the Light Versatile Graphic Library (LVGL) for Nim.

Supporting LVGL v9.2.

Dependencies

  • SLD2
  • wayland-client?
  • xkbcommon?

Installation

Install as usual:

$ nimble install https://github.com/mantielero/lvgl.nim

Status

The wrapper seems to work in Linux. There is no sugar yet, so right now is not very friendly.

You can find some working examples.

Wrapper creation

The wrapper creation is done using nimterop.

It just required:

  1. Running the file: src/wrapper/create_wrapper.sh
  2. Running the file: src/wrapper/compiles.sh
  3. Manually creating the file src/lvgl.nim

TODO

LVGL submodule in this repository

I added lvgl as a submodule:

$ git submodule add https://github.com/lvgl/lvgl.git src/lvgl/submodules/lvgl
$ git submodule init

Configuration

For the moment we will do:

$ cd src/submodules
$ wget https://raw.githubusercontent.com/lvgl/lv_port_pc_eclipse/master/lv_conf.h

The bindings creation just takes:

$ cd src/lvgl/wrapper
$ nim --maxLoopIterationsVM:10000000000 c -d:futharkRebuild -d:nodeclguards -d:generateInline create

which creates somehting like: lvgl_9_0_0.nim.

Updating submodules

In this repository root:

$ git submodule update --init --recursive
$ cd src/lvgl/submodules/lvgl
$ git checkout release/v9.2
$ git pull origin release/v9.2 
$ cd ../../../../
$ git add src/lvgl/submodules/lvgl/
$ git  commit -m "<src/lvgl/submodules/lvgl> submodule updated to v9.2"

Future

nim c --cc:clang --clang.exe=emcc --clang.linkerexe=emcc myFile.nim
nim c -r --cc:clang --clang.exe="zigcc" --clang.linkerexe="zigcc" borrame

Updating to a new version

  1. Update the submodule (for example to release/v9.2)
  2. Update src/lvgl/wrapper/create.nim so that it creates a new lvgl_9_2.nim.
  3. Compile it:
nim --maxLoopIterationsVM:10000000000 c -d:futharkRebuild -d:nodeclguards -d:generateInline create
  1. Edit src/lvgl/wrapper/lvgl.nim to refer the brand new: lvgl_9_2nim
  2. Execute:
$ ./gen_compiles.nims
  1. Copy lv_config.h as per the docs:
$ cd ../submodules
$ cp lvgl/lv_conf_template.h ../lv_config.h
  1. Modify the end of the file. It looks like:
....
/*Vector graphic demo*/
#define LV_USE_DEMO_VECTOR_GRAPHIC  1
/*--END OF LV_CONF_H--*/
#define LV_USE_MATRIX 1
#define LV_USE_FLOAT 1
#endif /*LV_CONF_H*/

#endif /*End of "Content enable"*/

Archlinux

$ yay -S lvgl

Install the headers:

ls /usr/include/lvgl/

And the libs:

/usr/lib/liblvgl.so    
/usr/lib/liblvgl_thorvg.so  

About

A wrapper for the Light Versatile Graphic Library (LVGL)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published