Closed rafaelcaricio closed 3 years ago
Does anyone managed to run it on WebAssembly? When I try to build it I get the following error:
_core/../lv_font/../lv_misc/lv_area.h:17:10: fatal error: 'string.h' file not found
cargo:warning=#include <string.h>
Hey @FloVanGH , I haven't tried yet. But I'd imagine that to compile to WebAssembly we would need to tweak our build.rs
to handle cases like this one.
Hey @rafaelcaricio.If you can adjust the build.rs
I can contribute an example 🙂.
I want to add an lvgl example to my crate: https://codeberg.org/morph/canvas-display. I have also a working desktop example for an other crate https://codeberg.org/morph/raqote-display.
@FloVanGH I can work on updating the build.rs
, but I'm pretty tight on free time right now so I cannot compromise when I can do it. I hope to get some time to work on lvgl-rs soon.
Awesome work, btw! :)
@FloVanGH I can work on updating the
build.rs
, but I'm pretty tight on free time right now so I cannot compromise when I can do it. I hope to get some time to work on lvgl-rs soon.
Ok I see. It's not urgent. But I hope you'll find some time. And I hope you can continue your work, it's really great 🙂.
Awesome work, btw! :)
Thank you 🙂
I've tried that this weekend and didn't work yet. I will continue trying to compile for the wasm32-unknown-emscripten
target, that one may work (https://github.com/rustwasm/team/issues/291).
Hey, ok thank you for your effort 🙂.
@FloVanGH after many hours of trial and error, it's possible to compile lvgl-rs to WASM after those changes https://github.com/rafaelcaricio/lvgl-rs/pull/31
I have an example here: https://github.com/rafaelcaricio/lvgl-rs-wasm (needs Rust nightly)
It compiles, but doesn't work in the browser. It panics at some slice index that supposed to not happen. Works fine when compiled to local binary.
@rafaelcaricio that's awesome :-) . Thank you. I will create an example for canvas-display
.
@FloVanGH No problem! Let me know if it works for you in the browser. As I said, even though I managed to make the example project compile successfully, it panics when running in the browser for some strange reason.
This is the error I get... :/
Ok thank you. I will check it.
@FloVanGH I managed to make it work! 🥳 The example project is running here: https://rafaelcaricio.github.io/lvgl-rs-wasm/
Example code: https://github.com/rafaelcaricio/lvgl-rs-wasm
🎉
Create a WebAssembly demo app using the web simulator of
embedded_graphics
library. It would be a great way to show the possibilities oflvgl-rs
by compiling to WASM. The example can also be a quick start for many people.