feat(make) add lvgl interface target for micropython (#2529)

* Add lvgl interface target for micropython

* Add indentation to CMakeLists.txt
This commit is contained in:
eudoxos
2021-09-06 10:39:51 +02:00
committed by GitHub
parent 69e9554af6
commit 715d580d8c

View File

@@ -64,14 +64,29 @@ zephyr_library()
file(GLOB_RECURSE SOURCES src/*.c)
zephyr_library_sources(${SOURCES})
endif() # CONFIG_LVGL
endif(CONFIG_LVGL)
else()
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/*.c)
add_library(lvgl STATIC ${SOURCES})
file(GLOB_RECURSE EXAMPLE_SOURCES ${CMAKE_CURRENT_LIST_DIR}/examples/*.c)
if(MICROPY_DIR)
# with micropython, build lvgl as interface library
# link chain is: lvgl_interface [lvgl] → usermod_lvgl_bindings [lv_bindings] → usermod [micropython] → firmware [micropython]
add_library(lvgl_interface INTERFACE)
# ${SOURCES} must NOT be given to add_library directly for some reason (won't be built)
target_sources(lvgl_interface INTERFACE ${SOURCES})
# Micropython builds with -Werror; we need to suppress some warnings, such as:
#
# /home/test/build/lv_micropython/ports/rp2/build-PICO/lv_mp.c:29316:16: error: 'lv_style_transition_dsc_t_path_xcb_callback' defined but not used [-Werror=unused-function]
# 29316 | STATIC int32_t lv_style_transition_dsc_t_path_xcb_callback(const struct _lv_anim_t * arg0)
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target_compile_options(lvgl_interface INTERFACE -Wno-unused-function)
else(MICROPY_DIR)
# without micropython, build lvgl and examples libs normally
add_library(lvgl STATIC ${SOURCES})
add_library(lvgl_examples STATIC ${EXAMPLE_SOURCES})
endif(MICROPY_DIR)
endif()