A wrapper of the Light Versatile Graphic Library (LVGL) for Nim.
Supporting LVGL v9.2.
- SLD2
- wayland-client?
- xkbcommon?
Install as usual:
$ nimble install https://github.com/mantielero/lvgl.nimThe wrapper seems to work in Linux. There is no sugar yet, so right now is not very friendly.
You can find some working examples.
The wrapper creation is done using nimterop.
It just required:
- Running the file:
src/wrapper/create_wrapper.sh - Running the file:
src/wrapper/compiles.sh - Manually creating the file
src/lvgl.nim
- To reproduce the examples found in the manual.
- To understand
LV_IMG_DECLARE
- To understand
- How to deal with callbacks?
- Move it to c2nim and individual files.
- Make it more friendly
- What to do with
src/components/lv_conf.h? - Multiplatform?
- To understand better: LV_SIZE_CONTENT (see ex06)
- Export to webassembly:
- Using dynamic library or static library
- Importing .png during the compilation process would be great. This would avoid the need for converting them to other formats or even into C code. This could be achieved with: staticRead.
I added lvgl as a submodule:
$ git submodule add https://github.com/lvgl/lvgl.git src/lvgl/submodules/lvgl
$ git submodule initFor 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.
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"nim c --cc:clang --clang.exe=emcc --clang.linkerexe=emcc myFile.nim
nim c -r --cc:clang --clang.exe="zigcc" --clang.linkerexe="zigcc" borrame
- Update the submodule (for example to
release/v9.2) - Update
src/lvgl/wrapper/create.nimso that it creates a newlvgl_9_2.nim. - Compile it:
nim --maxLoopIterationsVM:10000000000 c -d:futharkRebuild -d:nodeclguards -d:generateInline create- Edit
src/lvgl/wrapper/lvgl.nimto refer the brand new:lvgl_9_2nim - Execute:
$ ./gen_compiles.nims- Copy
lv_config.has per the docs:
$ cd ../submodules
$ cp lvgl/lv_conf_template.h ../lv_config.h- 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"*/$ yay -S lvglInstall the headers:
ls /usr/include/lvgl/
And the libs:
/usr/lib/liblvgl.so
/usr/lib/liblvgl_thorvg.so