arch(env): arch(env): move the cmake folder into the env_support folder
This commit is contained in:
67
env_support/cmake/custom.cmake
Normal file
67
env_support/cmake/custom.cmake
Normal file
@@ -0,0 +1,67 @@
|
||||
# Option to define LV_LVGL_H_INCLUDE_SIMPLE, default: ON
|
||||
option(LV_LVGL_H_INCLUDE_SIMPLE
|
||||
"Use #include \"lvgl.h\" instead of #include \"../../lvgl.h\"" ON)
|
||||
|
||||
# Option to define LV_CONF_INCLUDE_SIMPLE, default: ON
|
||||
option(LV_CONF_INCLUDE_SIMPLE
|
||||
"Simple include of \"lv_conf.h\" and \"lv_drv_conf.h\"" ON)
|
||||
|
||||
# Option to set LV_CONF_PATH, if set parent path LV_CONF_DIR is added to
|
||||
# includes
|
||||
option(LV_CONF_PATH "Path defined for lv_conf.h")
|
||||
get_filename_component(LV_CONF_DIR ${LV_CONF_PATH} DIRECTORY)
|
||||
|
||||
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
|
||||
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
|
||||
file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c)
|
||||
|
||||
add_library(lvgl STATIC ${SOURCES})
|
||||
add_library(lvgl::lvgl ALIAS lvgl)
|
||||
add_library(lvgl_examples STATIC ${EXAMPLE_SOURCES})
|
||||
add_library(lvgl::examples ALIAS lvgl_examples)
|
||||
add_library(lvgl_demos STATIC ${DEMO_SOURCES})
|
||||
add_library(lvgl::demos ALIAS lvgl_demos)
|
||||
|
||||
target_compile_definitions(
|
||||
lvgl PUBLIC $<$<BOOL:${LV_LVGL_H_INCLUDE_SIMPLE}>:LV_LVGL_H_INCLUDE_SIMPLE>
|
||||
$<$<BOOL:${LV_CONF_INCLUDE_SIMPLE}>:LV_CONF_INCLUDE_SIMPLE>)
|
||||
|
||||
# Include root and optional parent path of LV_CONF_PATH
|
||||
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR})
|
||||
|
||||
# Include /examples folder
|
||||
target_include_directories(lvgl_examples SYSTEM
|
||||
PUBLIC ${LVGL_ROOT_DIR}/examples)
|
||||
target_include_directories(lvgl_demos SYSTEM
|
||||
PUBLIC ${LVGL_ROOT_DIR}/demos)
|
||||
|
||||
target_link_libraries(lvgl_examples PUBLIC lvgl)
|
||||
target_link_libraries(lvgl_demos PUBLIC lvgl)
|
||||
|
||||
# Lbrary and headers can be installed to system using make install
|
||||
file(GLOB LVGL_PUBLIC_HEADERS "${CMAKE_SOURCE_DIR}/lv_conf.h"
|
||||
"${CMAKE_SOURCE_DIR}/lvgl.h")
|
||||
|
||||
if("${LIB_INSTALL_DIR}" STREQUAL "")
|
||||
set(LIB_INSTALL_DIR "lib")
|
||||
endif()
|
||||
if("${INC_INSTALL_DIR}" STREQUAL "")
|
||||
set(INC_INSTALL_DIR "include/lvgl")
|
||||
endif()
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_SOURCE_DIR}/src"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
set_target_properties(
|
||||
lvgl
|
||||
PROPERTIES OUTPUT_NAME lvgl
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
|
||||
|
||||
install(
|
||||
TARGETS lvgl
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
|
||||
33
env_support/cmake/esp.cmake
Normal file
33
env_support/cmake/esp.cmake
Normal file
@@ -0,0 +1,33 @@
|
||||
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
|
||||
|
||||
idf_build_get_property(LV_MICROPYTHON LV_MICROPYTHON)
|
||||
|
||||
if(LV_MICROPYTHON)
|
||||
idf_component_register(
|
||||
SRCS
|
||||
${SOURCES}
|
||||
INCLUDE_DIRS
|
||||
${LVGL_ROOT_DIR}
|
||||
${LVGL_ROOT_DIR}/src
|
||||
${LVGL_ROOT_DIR}/../
|
||||
REQUIRES
|
||||
main)
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
INTERFACE "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
INTERFACE "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
|
||||
endif()
|
||||
else()
|
||||
idf_component_register(SRCS ${SOURCES} INCLUDE_DIRS ${LVGL_ROOT_DIR}
|
||||
${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../)
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
|
||||
endif()
|
||||
endif()
|
||||
18
env_support/cmake/micropython.cmake
Normal file
18
env_support/cmake/micropython.cmake
Normal 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)
|
||||
14
env_support/cmake/zephyr.cmake
Normal file
14
env_support/cmake/zephyr.cmake
Normal file
@@ -0,0 +1,14 @@
|
||||
if(CONFIG_LVGL)
|
||||
|
||||
zephyr_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl)
|
||||
|
||||
target_include_directories(lvgl INTERFACE ${LVGL_ROOT_DIR})
|
||||
|
||||
zephyr_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE=<autoconf.h>)
|
||||
|
||||
zephyr_library()
|
||||
|
||||
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
|
||||
zephyr_library_sources(${SOURCES})
|
||||
|
||||
endif(CONFIG_LVGL)
|
||||
Reference in New Issue
Block a user