Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 1 | PACKAGECONFIG ??= "drm" |
| 2 | |
| 3 | PACKAGECONFIG[drm] = ",,libdrm" |
| 4 | PACKAGECONFIG[fbdev] = ",," |
| 5 | PACKAGECONFIG[sdl] = ",,virtual/libsdl2 libsdl2-image" |
| 6 | |
| 7 | # Add libdrm include if drm is selected in PACKAGECONFIG |
| 8 | TARGET_CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)}" |
| 9 | |
| 10 | LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}" |
| 11 | |
| 12 | LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}" |
| 13 | |
| 14 | LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}" |
| 15 | |
| 16 | LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}" |
| 17 | LVGL_CONFIG_SDL_FULLSCREEN ?= "0" |
| 18 | |
| 19 | LVGL_CONFIG_LV_MEM_CUSTOM ?= "0" |
| 20 | LVGL_CONFIG_LV_MEM_SIZE ?= "(64 * 1024U)" |
| 21 | LVGL_CONFIG_LV_COLOR_DEPTH ?= "32" |
| 22 | |
| 23 | LVGL_CONFIG_LV_USE_LOG ?= "0" |
| 24 | LVGL_CONFIG_LV_LOG_LEVEL ?= "LV_LOG_LEVEL_WARN" |
| 25 | LVGL_CONFIG_LV_LOG_PRINTF ?= "0" |
| 26 | |
| 27 | LVGL_CONFIG_LV_USE_FONT_COMPRESSED ?= "0" |
| 28 | |
| 29 | LVGL_CONFIG_LV_THEME_DEFAULT_DARK ?= "0" |
| 30 | |
| 31 | DEBUG_BUILD ??= "0" |
| 32 | |
| 33 | ALLOW_EMPTY:${PN} = "1" |
| 34 | |
| 35 | EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}" |
| 36 | |
| 37 | do_configure:append() { |
| 38 | # If there is a configuration template, start from that |
| 39 | [ -r "${S}/lv_conf_template.h" ] && cp -Lv "${S}/lv_conf_template.h" "${S}/lv_conf.h" |
| 40 | |
| 41 | sed -r -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|" \ |
| 42 | \ |
| 43 | -e "s|^([[:space:]]*#define LV_USE_LINUX_DRM[[:space:]]).*|\1${LVGL_CONFIG_USE_DRM}|" \ |
| 44 | \ |
| 45 | -e "s|^([[:space:]]*#define LV_USE_LINUX_FBDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_FBDEV}|" \ |
| 46 | \ |
| 47 | -e "s|^([[:space:]]*#define LV_USE_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \ |
| 48 | -e "s|^([[:space:]]*#define LV_USE_DRAW_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \ |
| 49 | -e "s|^([[:space:]]*#define LV_SDL_BUF_COUNT[[:space:]]).*|\1 2|" \ |
| 50 | -e "s|^([[:space:]]*#define LV_SDL_FULLSCREEN[[:space:]]).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|" \ |
| 51 | \ |
| 52 | -e "s|^([[:space:]]*#define LV_COLOR_DEPTH[[:space:]]).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|" \ |
| 53 | -e "s|^([[:space:]]*#define LV_MEM_CUSTOM[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|" \ |
| 54 | -e "s|^([[:space:]]*#define LV_MEM_SIZE[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|" \ |
| 55 | \ |
| 56 | -e "s|^([[:space:]]*#define LV_TICK_CUSTOM[[:space:]]).*|\1 1|" \ |
| 57 | -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_INCLUDE[[:space:]]).*|\1 <stdint.h>|" \ |
| 58 | -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[[:space:]]).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|" \ |
| 59 | \ |
| 60 | -e "s|^([[:space:]]*#define LV_USE_EVDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_EVDEV}|" \ |
| 61 | \ |
| 62 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_NULL[[:space:]]).*|\1${DEBUG_BUILD}|" \ |
| 63 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_MALLOC[[:space:]]).*|\1${DEBUG_BUILD}|" \ |
| 64 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_STYLE[[:space:]]).*|\1${DEBUG_BUILD}|" \ |
| 65 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_MEM_INTEGRITY[[:space:]]).*|\1${DEBUG_BUILD}|" \ |
| 66 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_OBJ[[:space:]]).*|\1${DEBUG_BUILD}|" \ |
| 67 | \ |
| 68 | -e "s|^([[:space:]]*#define LV_USE_LOG[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_LOG}|" \ |
| 69 | -e "s|^([[:space:]]*#define LV_LOG_LEVEL[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|" \ |
| 70 | -e "s|^([[:space:]]*#define LV_LOG_PRINTF[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|" \ |
| 71 | \ |
| 72 | -e "s|^([[:space:]]*#define LV_USE_FONT_COMPRESSED[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|" \ |
| 73 | -e "s|^([[:space:]]*#define LV_THEME_DEFAULT_DARK[[:space:]]).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|" \ |
| 74 | \ |
| 75 | -i "${S}/lv_conf.h" |
| 76 | } |