2020-09-21 18:08:31 +00:00
|
|
|
# LVGL Rust to WASM
|
2020-09-21 17:33:08 +00:00
|
|
|
|
2020-09-21 18:08:31 +00:00
|
|
|
Example of LVLG in Rust compiling to WASM.
|
2020-09-21 17:33:08 +00:00
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
2020-09-21 18:00:48 +00:00
|
|
|
- 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
|
2020-09-21 17:33:08 +00:00
|
|
|
|
2020-09-21 18:00:48 +00:00
|
|
|
# Activate PATH and other environment variables in the current terminal
|
|
|
|
source ./emsdk_env.sh
|
|
|
|
```
|
|
|
|
https://emscripten.org/docs/getting_started/downloads.html
|
|
|
|
|
|
|
|
- Compile SDL2:
|
2020-09-21 17:33:08 +00:00
|
|
|
```
|
|
|
|
$ embuilder.py build sdl2
|
|
|
|
```
|
2020-09-21 18:00:48 +00:00
|
|
|
|
2020-09-21 18:53:30 +00:00
|
|
|
- Compile the example project:
|
|
|
|
```
|
|
|
|
cargo +nightly build --target=wasm32-unknown-emscripten
|
|
|
|
```
|
|
|
|
|
2020-09-21 18:00:48 +00:00
|
|
|
References:
|
|
|
|
- https://puddleofcode.com/story/definitive-guide-to-rust-sdl2-and-emscriptem
|
|
|
|
|