Linux project

Create a ready-to-build embedded Linux project from the LVGL Pro Editor launcher, with DRM/KMS, framebuffer, SDL2, Wayland, and X11 backends.

This feature requires LVGL Pro Editor v2.0 or higher.

The Editor can generate a complete, ready-to-build Linux project for you — the same way it creates a Zephyr project or a VS Code project. The primary target is embedded Linux (it ships DRM/KMS and framebuffer backends for boards), but it also runs on desktop Linux via SDL2, Wayland, or X11, so you can develop and iterate without hardware.

LVGL itself is downloaded automatically by CMake, so there's nothing to clone or wire up by hand. Your UI is exported into the project's ui/ folder and picked up automatically.

Create a project

On the Editor's home screen, choose Linux as the target project. On the launcher you can set:

  • Display resolution — the logical resolution passed to LVGL (default 800 × 480).
  • Display backends — which backends to compile in. At runtime they are tried in order until one initializes: SDL → Wayland → X11 → DRM → fbdev. It's safe to leave several enabled; the right one is picked automatically.
  • Optional features — e.g. 3D support (OpenGL ES + NanoVG). These can also be changed later in lv_conf.defaults.

Get started

The generated project is a standard CMake application. Its README.md has the full details; the steps below are the general flow.

1. Install the requirements

You always need CMake ≥ 3.18, Python 3 (+ python3-venv), and a C/C++ compiler. Ninja is optional but speeds up builds. Beyond that, install the development libraries for the backends and features you enabled:

bash
# Debian / Ubuntu
sudo apt install \
  build-essential cmake ninja-build python3 python3-venv \
  libsdl2-dev \
  libwayland-dev libxkbcommon-dev \
  libx11-dev \
  libdrm-dev \
  libevdev-dev \
  libgles2-mesa-dev
bash
# Arch
sudo pacman -S \
  base-devel cmake ninja python python-virtualenv \
  sdl2 wayland libxkbcommon libx11 libdrm libevdev mesa
bash
# Fedora
sudo dnf install \
  @development-tools cmake ninja-build python3 python3-virtualenv \
  SDL2-devel wayland-devel libxkbcommon-devel libX11-devel \
  libdrm-devel libevdev-devel mesa-libGLES-devel

On first configure, CMake fetches LVGL and other optional libraries (FreeType, libpng, libjpeg-turbo, …) automatically. Only kernel-coupled libraries such as libdrm must be present on the system (or in your sysroot when cross-compiling) — they are not fetched.

2. Build and run

bash
cmake -B build -GNinja
cmake --build build
./build/lvgl_linux

Run the binary from the project root so the A:ui asset path resolves to the ui/ folder. You can override the resolution (and other options) at configure time:

bash
cmake -B build -DLV_HOR_RES=1280 -DLV_VER_RES=800

Configuration

LVGL is configured through lv_conf.defaults in the project root. CMake merges it with LVGL's lv_conf_template.h at configure time to produce build/lv_conf.h. Only options that differ from the defaults need to be listed. Common backend switches:

OptionDescription
LV_USE_SDLSDL2 backend
LV_USE_WAYLANDWayland backend
LV_USE_X11X11 backend
LV_USE_LINUX_DRMDRM/KMS backend (embedded)
LV_USE_LINUX_FBDEVFramebuffer backend (embedded)
LV_USE_EVDEVevdev input (needed for DRM and fbdev)

A few useful CMake cache variables (pass with -D):

VariableDefaultDescription
LV_HOR_RES / LV_VER_RES800 / 480Display resolution
UI_DIRuiPath to the exported Editor UI
UI_PROJECT_NAME(auto)Override the UI init function name
UI_DEFAULT_SCREEN(auto)Override the default screen to load

Cross-compiling for a board

For an embedded target, build with a CMake toolchain file that sets the cross compiler, sysroot, and architecture:

bash
cmake -B build-arm -GNinja \
  -DCMAKE_TOOLCHAIN_FILE=toolchain-armv7.cmake \
  -DLV_HOR_RES=480 -DLV_VER_RES=272
cmake --build build-arm

Libraries fetched by CMake (LVGL, FreeType, …) are compiled for the target automatically; system libraries such as libdrm must be present in the sysroot. For Yocto and Buildroot, use the toolchain file generated by the SDK (environment-setup-* for Yocto, .../toolchainfile.cmake for Buildroot). See the project's README.md for a complete toolchain-file example.

Updating the UI

Design your UI in the Editor and export to the project's ui/ folder. The build system detects it automatically and links it into the application, so re-exporting is all it takes to update the interface.

Last updated on

On this page