fix(CMake) split CMakeLists.txt, add options, includes and dependencies (#2753)

* fix(CMake) split CMakeLists.txt, add options, includes and dependencies

* fix(CMake) do not use 'project' keyword with ESP_PLATFORM

* fix(CMake) prefix includes with CMAKE_CURRENT_LIST_DIR

* Don't depend on CMAKE_CURRENT_SOURCE_DIR

* fix(CMake) rename baremetal.cmake to custom.cmake

* fix(CMake) add CMake documentation
This commit is contained in:
Vincent Hamp
2021-11-22 10:51:51 +01:00
committed by GitHub
parent 3ea4d66411
commit a8f30120ce
7 changed files with 231 additions and 90 deletions

18
cmake/micropython.cmake Normal file
View File

@@ -0,0 +1,18 @@
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
# 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)