Example of LVLG in Rust compiled to WASM.
Find a file
2020-09-22 10:17:51 +02:00
.cargo Compile to Emscripten HTML file 2020-09-22 09:46:47 +02:00
docs Update readme with images 2020-09-22 10:17:51 +02:00
include Example compiles to emscripten 2020-09-21 20:07:36 +02:00
src Update running project 2020-09-22 10:10:10 +02:00
.gitattributes Update running project 2020-09-22 10:10:10 +02:00
.gitignore Compile to Emscripten HTML file 2020-09-22 09:46:47 +02:00
Cargo.lock Use branch reference in deps 2020-09-21 20:53:30 +02:00
Cargo.toml Use branch reference in deps 2020-09-21 20:53:30 +02:00
LICENSE Initial commit 2020-09-21 20:06:42 +02:00
Makefile Update running project 2020-09-22 10:10:10 +02:00
README.md Update readme with images 2020-09-22 10:17:51 +02:00

LVGL Rust to WASM

Example of LVGL in Rust compiling to WASM. The same project can run natively and in the browser.

Access the web live version here.

Project Running Natively

Setup

  • Install Emscripten
# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

https://emscripten.org/docs/getting_started/downloads.html

  • Compile SDL2:
$ embuilder.py build sdl2

Compiling

Compile the Web version:

make web

Compile the native version:

make native

Running

To access the web version you need to serve the static files as web pages locally. We use python3 for that. If you have Python 3 installed, you can run:

make serve

Now you can access locally the project running at http://localhost:8000/lvgl_example.html .

For running natively, you can do:

cargo +nightly run --release

References