Copy lvgl-demo-fb recipe from meta-openebedded master branch

https://onedigi.atlassian.net/browse/DEL-8740

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2023-10-24 14:29:35 +02:00
parent 66af49ef9e
commit 33a93ccae4
2 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,48 @@
PACKAGECONFIG[drm] = ",,libdrm"
PACKAGECONFIG[fbdev] = ",,"
PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}"
LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}"
LVGL_CONFIG_EVDEV_INPUT ?= "/dev/input/touchscreen"
LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}"
LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}"
LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', '1', '0', d)}"
LVGL_CONFIG_WAYLAND_HOR_RES ?= "480"
LVGL_CONFIG_WAYLAND_VER_RES ?= "320"
ALLOW_EMPTY:${PN} = "1"
EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
do_configure:append() {
# If there is a configuration template, start from that
[ -r "${S}/lv_drv_conf_template.h" ] && cp -Lv "${S}/lv_drv_conf_template.h" "${S}/lv_drv_conf.h"
# Configure the software using sed
sed -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // Enabled by ${PN}|g" \
\
-e "s|\(^# define USE_DRM \).*|# define USE_DRM ${LVGL_CONFIG_USE_DRM}|g" \
-e "s|\(^# define DRM_CARD \).*|# define DRM_CARD \"${LVGL_CONFIG_DRM_CARD}\"|g" \
\
-e "s|\(^# define USE_EVDEV \).*|# define USE_EVDEV ${LVGL_CONFIG_USE_EVDEV}|g" \
-e "s|\(^# define EVDEV_NAME \).*|# define EVDEV_NAME \"${LVGL_CONFIG_EVDEV_INPUT}\"|g" \
\
-e "s|\(^# define USE_FBDEV \).*|# define USE_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
\
-e "s|\(^# define USE_SDL \).*|# define USE_SDL ${LVGL_CONFIG_USE_SDL}|g" \
-e "s|\(^# define USE_SDL_GPU \).*|# define USE_SDL_GPU 1|g" \
-e "s|\(^# define SDL_DOUBLE_BUFFERED \).*|# define SDL_DOUBLE_BUFFERED 1|g" \
\
-e "s|\(^# define USE_WAYLAND \).*|# define USE_WAYLAND ${LVGL_CONFIG_USE_WAYLAND}|g" \
-e "s|\(^ *# *define *WAYLAND_HOR_RES *\).*|\1${LVGL_CONFIG_WAYLAND_HOR_RES}|g" \
-e "s|\(^ *# *define *WAYLAND_VER_RES *\).*|\1${LVGL_CONFIG_WAYLAND_VER_RES}|g" \
\
-i "${S}/lv_drv_conf.h"
}

View File

@ -0,0 +1,46 @@
SUMMARY = "LVGL Demo Application for Framebuffer"
HOMEPAGE = "https://github.com/lvgl/lv_port_linux_frame_buffer"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=802d3d83ae80ef5f343050bf96cce3a4 \
file://lv_drivers/LICENSE;md5=d6fc0df890c5270ef045981b516bb8f2 \
file://lvgl/LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "gitsm://github.com/lvgl/lv_port_linux_frame_buffer.git;branch=master;protocol=https"
SRCREV = "adf2c4490e17a1b9ec1902cc412a24b3b8235c8e"
EXTRA_OEMAKE = "DESTDIR=${D}"
PACKAGECONFIG ??= "drm"
require lv-drivers.inc
inherit cmake
S = "${WORKDIR}/git"
TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
do_configure:prepend() {
if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then
# Add libdrm build dependency
sed -i '/^target_link_libraries/ s@lvgl::drivers@& drm@' "${S}/CMakeLists.txt"
# Switch from fbdev to drm usage
sed -i 's@fbdev@drm@g' "${S}/main.c"
# Pull resolution from DRM instead of hardcoding it
sed -i '/disp_drv.hor_res/ d' "${S}/main.c"
sed -i '/disp_drv.ver_res/ s@disp_drv.ver_res.*@drm_get_sizes(\&disp_drv.hor_res, \&disp_drv.ver_res, NULL);@' "${S}/main.c"
fi
if [ "${LVGL_CONFIG_USE_SDL}" -eq 1 ] ; then
# Add libsdl build dependency
sed -i '/^target_link_libraries/ s@lvgl::drivers@& SDL2@' "${S}/CMakeLists.txt"
# Switch from fbdev to sdl usage
sed -i 's@fbdev_flush@sdl_display_flush@g' "${S}/main.c"
sed -i 's@lv_drivers/display/fbdev.h@lv_drivers/sdl/sdl.h@g' "${S}/main.c"
sed -i 's@fbdev@sdl@g' "${S}/main.c"
fi
}
do_install:append() {
install -d ${D}${bindir}
install -m 0755 ${B}/lvgl_fb ${D}${bindir}/
}