1file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
2
3idf_build_get_property(LV_MICROPYTHON LV_MICROPYTHON)
4
5if(LV_MICROPYTHON)
6  idf_component_register(
7    SRCS
8    ${SOURCES}
9    INCLUDE_DIRS
10    ${LVGL_ROOT_DIR}
11    ${LVGL_ROOT_DIR}/src
12    ${LVGL_ROOT_DIR}/../
13    REQUIRES
14    main)
15else()
16  if(CONFIG_LV_BUILD_EXAMPLES)
17    file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
18    set_source_files_properties(${EXAMPLE_SOURCES} COMPILE_FLAGS "-Wno-unused-variable -Wno-format")
19  endif()
20
21  if(CONFIG_LV_USE_DEMO_WIDGETS)
22    file(GLOB_RECURSE DEMO_WIDGETS_SOURCES ${LVGL_ROOT_DIR}/demos/widgets/*.c)
23    list(APPEND DEMO_SOURCES ${DEMO_WIDGETS_SOURCES})
24  endif()
25  if(CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER)
26    file(GLOB_RECURSE DEMO_KEYPAD_AND_ENCODER_SOURCES ${LVGL_ROOT_DIR}/demos/keypad_encoder/*.c)
27    list(APPEND DEMO_SOURCES ${DEMO_KEYPAD_AND_ENCODER_SOURCES})
28  endif()
29  if(CONFIG_LV_USE_DEMO_BENCHMARK)
30    file(GLOB_RECURSE DEMO_BENCHMARK_SOURCES ${LVGL_ROOT_DIR}/demos/benchmark/*.c)
31    list(APPEND DEMO_SOURCES ${DEMO_BENCHMARK_SOURCES})
32  endif()
33  if(CONFIG_LV_USE_DEMO_STRESS)
34    file(GLOB_RECURSE DEMO_STRESS_SOURCES ${LVGL_ROOT_DIR}/demos/stress/*.c)
35    list(APPEND DEMO_SOURCES ${DEMO_STRESS_SOURCES})
36  endif()
37  if(CONFIG_LV_USE_DEMO_MUSIC)
38    file(GLOB_RECURSE DEMO_MUSIC_SOURCES ${LVGL_ROOT_DIR}/demos/music/*.c)
39    list(APPEND DEMO_SOURCES ${DEMO_MUSIC_SOURCES})
40    set_source_files_properties(${DEMO_MUSIC_SOURCES} COMPILE_FLAGS "-Wno-format")
41  endif()
42
43  idf_component_register(SRCS ${SOURCES} ${EXAMPLE_SOURCES} ${DEMO_SOURCES}
44      INCLUDE_DIRS ${LVGL_ROOT_DIR} ${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../
45                   ${LVGL_ROOT_DIR}/examples ${LVGL_ROOT_DIR}/demos
46      REQUIRES esp_timer)
47endif()
48
49target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
50
51if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
52  target_compile_definitions(${COMPONENT_LIB}
53                             PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
54endif()
55