A minimal, ready-to-debug PC simulator for LVGL and the LVGL Editor. It runs LVGL in an SDL window so you can build and debug embedded GUIs without any hardware.
lvgl/– LVGL as a git submodulelv_conf.h– LVGL configurationui/– export your UI from the LVGL Editor heresrc/–main.cand the SDL display/input setup.vscode/– build, run and debug configuration
git clone --recursive https://github.com/lvgl/lv_port_pc_vscodeIf you cloned without --recursive, run git submodule update --init.
You need CMake (≥ 3.16), a C compiler, a debugger and SDL2.
# Debian / Ubuntu
sudo apt install build-essential cmake gdb libsdl2-dev
# Arch
sudo pacman -S base-devel cmake gdb sdl2
# Fedora
sudo dnf install @development-tools cmake gdb SDL2-devel
# macOS
brew install cmake sdl2On Windows use MSYS2:
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2- Open the project folder and install the recommended extensions (CodeLLDB, clangd).
- Press F5 to build and start debugging.
Ctrl+Shift+B only builds; the Run task builds and runs without the debugger.
cmake -B build
cmake --build build -j
cmake --build build --target runThe run target starts the simulator from the project root, so the A:ui
asset path resolves to the ui/ folder.
LVGL is configured in lv_conf.h. It is generated from
configs/base.defconfig, plus the optional fragments in
configs/fragments/ (logging, monitors, asserts). The LVGL
Editor regenerates it when you configure the project. Without the Editor, edit
lv_conf.h directly.
The window size is set by hal_init(800, 480) in src/main.c.
Export C code from the LVGL Editor into the ui/ folder. It is detected
automatically and main.c calls ui_init("A:ui"). To show one of your screens, uncomment
the lv_screen_load(...) example in src/main.c and put your
screen's create function in it.
See using exported C code.
Until a UI is exported, the LVGL widgets demo runs.
- LVGL documentation: https://lvgl.io/docs/open
- LVGL Pro documentation: https://lvgl.io/docs/pro
- LVGL forum: https://forum.lvgl.io
- Issues: https://github.com/lvgl/lv_port_pc_vscode/issues