LVGL ported to Emscripten to be converted to JavaScript
The result looks like this https://lvgl.io/demos
Downlad SDL (a graphics library to ope na window and handle the mouse). On Linux:
apt-cache search libsdl2 (e.g. libsdl2-2.0-0)
sudo apt-get install libsdl2-2.0-0
(replace with the found version)sudo apt-get install libsdl2-dev
sudo apt-get install build-essential
Download the Emscripten SDK and make sure it is in your PATH.
git clone https://github.com/emscripten-core/emsdk.git
cd <path-to-emsdk>
git pull
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
More info here: https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
. <path-to-emsdk>/emsdk_env.sh
to add EMSDK to PATH
git clone --recursive https://github.com/lvgl/lv_web_emscripten.git
cd <path-to-emscripten>
mkdir cmbuild
cd cmbuild
emcmake cmake ..
emmake make -j4
index.html
will be generated. Run this in your browser.LVGL_CHOSEN_DEMO
can be set to the desired demo name so that you don't need to change any C files. This is useful to compile many demos in bulk using a script.Example emcmake cmake .. -DLVGL_CHOSEN_DEMO=lv_demo_widgets
Chrome might not be able to open the generated html file offline. It works if you copy the files to a server. Use Firefox or other browser for offline testing if needed.
Firefox cmight no be able to open the generated html file offline unless you go to about:config
and change privacy.file_unique_origin
to false
.