Emscripten port
LittlevGL ported to Emscripten to be converted to JavaScript
The result looks like this https://lvgl.io/demos
How to get started
Install SDL
Downlad SDL (a graphics library to ope na window and handle the mouse). On Linux:
- Find the current version of SDL2:
apt-cache search libsdl2 (e.g. libsdl2-2.0-0) - Install SDL2:
sudo apt-get install libsdl2-2.0-0(replace with the found version) - Install SDL2 development package:
sudo apt-get install libsdl2-dev - If build essentials are not installed yet:
sudo apt-get install build-essential
Install Emscripten SDK
Download the Emscripten SDK and make sure it is in your PATH.
git clone https://github.com/emscripten-core/emsdk.gitcd <path-to-emsdk>git pull./emsdk install latest./emsdk activate latestsource ./emsdk_env.sh
More info here: https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
Get the Emscripten-LittlevGL project
- Be sure you ran
. <path-to-emsdk>/emsdk_env.shto add EMSDK toPATH - In any directoy:
git clone --recursive https://github.com/littlevgl/emscripten.git cd <path-to-emscripten>makeoremconfigure cmake -DCMAKE_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" -S . -B build && cmake --build build -j $(nproc)- A file called
lvgl.htmlorbuild/lvgl.htmlwill be generated. Run this in your browser.
Known issue with Google Chrome browser
Chrome can't open the generated html file offline. It works if you copy the files to a server. Use Firefox or other browser for offline testing.
Known issue with Firefox
Firefox can't open the generated html file offline unless you go to about:config and change privacy.file_unique_origin to false.