Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@ jobs:

- name: FBDEV Test building the project
run: |
sed -i "s/^#define LV_USE_LINUX_FBDEV.*$/#define LV_USE_LINUX_FBDEV 1/g" lv_conf.h && \
sed -i "s/^#define LV_USE_LINUX_DRM.*$/#define LV_USE_LINUX_DRM 0/g" lv_conf.h && \
sed -i "s/^#define LV_USE_SDL.*$/#define LV_USE_SDL 0/g" lv_conf.h && \
sed -i "s/LV_USE_LINUX_FBDEV.*$/LV_USE_LINUX_FBDEV 1/g" lv_conf.defaults && \
sed -i "s/LV_USE_LINUX_DRM.*$/LV_USE_LINUX_DRM 0/g" lv_conf.defaults && \
sed -i "s/LV_USE_SDL.*$/LV_USE_SDL 0/g" lv_conf.defaults && \
docker run --rm -v "$(pwd)":/workdir -t test_${{ matrix.os.image }} \
/bin/bash -ec "cmake -DCMAKE_C_FLAGS=-Werror -B build -S . && make -j -C build && ldd build/bin/lvglsim"

- name: DRM Test building the project
run: |
sudo rm -Rf build/ bin/ && \
sed -i "s/^#define LV_USE_LINUX_FBDEV.*$/#define LV_USE_LINUX_FBDEV 0/g" lv_conf.h && \
sed -i "s/^#define LV_USE_LINUX_DRM.*$/#define LV_USE_LINUX_DRM 1/g" lv_conf.h && \
sed -i "s/^#define LV_USE_SDL.*$/#define LV_USE_SDL 0/g" lv_conf.h && \
sed -i "s/LV_USE_LINUX_FBDEV.*$/LV_USE_LINUX_FBDEV 0/g" lv_conf.defaults && \
sed -i "s/LV_USE_LINUX_DRM.*$/LV_USE_LINUX_DRM 1/g" lv_conf.defaults && \
sed -i "s/LV_USE_SDL.*$/LV_USE_SDL 0/g" lv_conf.defaults && \
docker run --rm -v "$(pwd)":/workdir -t test_${{ matrix.os.image }} \
/bin/bash -ec "cmake -DCMAKE_C_FLAGS=-Werror -B build -S . && make -j -C build && ldd build/bin/lvglsim"

- name: SDL Test building the project
run: |
sudo rm -Rf build/ bin/ && \
sed -i "s/^#define LV_USE_LINUX_FBDEV.*$/#define LV_USE_LINUX_FBDEV 0/g" lv_conf.h && \
sed -i "s/^#define LV_USE_LINUX_DRM.*$/#define LV_USE_LINUX_DRM 0/g" lv_conf.h && \
sed -i "s/^#define LV_USE_SDL.*$/#define LV_USE_SDL 1/g" lv_conf.h && \
sed -i "s/LV_USE_LINUX_FBDEV.*$/LV_USE_LINUX_FBDEV 0/g" lv_conf.defaults && \
sed -i "s/LV_USE_LINUX_DRM.*$/LV_USE_LINUX_DRM 0/g" lv_conf.defaults && \
sed -i "s/LV_USE_SDL.*$/LV_USE_SDL 1/g" lv_conf.defaults && \
docker run --rm -v "$(pwd)":/workdir -t test_${{ matrix.os.image }} \
/bin/bash -ec "cmake -DCMAKE_C_FLAGS=-Werror -B build -S . && make -j -C build && ldd build/bin/lvglsim"

30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,36 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic")
set(LV_BUILD_SET_CONFIG_OPTS ON CACHE BOOL
"create CMAKE variables from lv_conf_internal.h" FORCE)

set(LV_BUILD_CONF_PATH
"${CMAKE_BINARY_DIR}/lv_conf.h"
CACHE PATH "path to lv_conf.h" FORCE)

set(LVGL_TEMPLATE_PATH "${CMAKE_SOURCE_DIR}/lvgl/lv_conf_template.h")
set(LV_CONF_DEFAULTS_PATH "${CMAKE_SOURCE_DIR}/lv_conf.defaults")
set(GENERATE_SCRIPT_PATH "${CMAKE_SOURCE_DIR}/lvgl/scripts/generate_lv_conf.py")

configure_file(${LVGL_TEMPLATE_PATH} ${CMAKE_BINARY_DIR}/lv_conf_template.h
COPYONLY)
configure_file(${LV_CONF_DEFAULTS_PATH} ${CMAKE_BINARY_DIR}/lv_conf.defaults
COPYONLY)
configure_file(${GENERATE_SCRIPT_PATH} ${CMAKE_BINARY_DIR}/generate_lv_conf.py
COPYONLY)

execute_process(
COMMAND
${Python3_EXECUTABLE} ${GENERATE_SCRIPT_PATH} --template
${LVGL_TEMPLATE_PATH} --defaults ${LV_CONF_DEFAULTS_PATH} --config
${LV_BUILD_CONF_PATH}
RESULT_VARIABLE config_result
OUTPUT_VARIABLE config_output
ERROR_VARIABLE config_error)

if(NOT config_result EQUAL 0)
message(FATAL_ERROR "Failed to generate lv_conf.h: ${config_error}")
endif()

message(STATUS "${LV_BUILD_CONF_PATH} generated successfully")

add_subdirectory(lvgl)

if (CONFIG_LV_USE_EVDEV)
Expand Down
73 changes: 0 additions & 73 deletions Makefile

This file was deleted.

30 changes: 11 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git submodule update --init --recursive

## Configure drivers and libraries

Adjust `lv_conf.h` to select the drivers and libraries that will be compiled by
Adjust `lv_conf.defaults` to select the drivers and libraries that will be compiled by
modifying the following definitions, setting them to `1` or `0`

### Graphics drivers
Expand All @@ -46,6 +46,7 @@ modifying the following definitions, setting them to `1` or `0`
| Definition | Description |
| ------------------ | ----------------------------------------|
| LV_USE_EVDEV | libevdev input devices |
| LV_USE_LIBINPUT | libinput input devices |

## Install dependencies

Expand All @@ -63,28 +64,21 @@ LVGL supports GNU make and CMake
### CMake

```
cmake -B build -S .
make -C build -j
```

### GNU make

```
make -j
cmake -B build
cmake --build build -j$(nproc)
```

Cross compilation is supported with CMake, edit the `user_cross_compile_setup.cmake`
to set the location of the compiler toolchain and build using the commands below

```
cmake -DCMAKE_TOOLCHAIN_FILE=./user_cross_compile_setup.cmake -B build -S .
make -C build -j
cmake -B build -DCMAKE_TOOLCHAIN_FILE=./user_cross_compile_setup.cmake
cmake --build build -j$(nproc)
```

### Installing LVGL

It is possible to install LVGL to your system however, this is currently only
supported with cmake.
It is possible to install LVGL to your system using cmake:

```
cmake --install ./build
Expand All @@ -95,6 +89,7 @@ cmake --install ./build
```
./build/bin/lvglsim
```

This will start the widgets demo

If multiple backends are enabled you can run with a specific backend via the `-b` option
Expand Down Expand Up @@ -135,13 +130,10 @@ Check the documentation of the drivers for more details

## Permissions

When using fbdev or DRM, run lvglsim with `sudo` or `su`,
Usually, unpriviledged users don't have access to the framebuffer device `/dev/fb0`
`sudo` or `su` must be used.

Access to the framebuffer device can be granted by adding the unpriviledged user to the `video` group
By default, unpriviledged users don't have access to the framebuffer device `/dev/fb0`. In such cases, you can either run the application
with `sudo` privileges or you can grant access to the `video` group.

```
```bash
sudo adduser $USER video
newgrp video
./build/bin/lvglsim
Expand Down
Loading
Loading