feat: Organize CMakeLists for modular source management across main components

This commit is contained in:
GW_MC
2026-02-03 15:43:56 +08:00
parent 7bd230f591
commit a008106d47
10 changed files with 87 additions and 1 deletions

View File

@@ -1,5 +1,20 @@
set(requires esp-tls spi_flash nvs_flash esp_event esp_netif esp_http_client esp_http_server esp_wifi esp_psram esp_lvgl_port)
file(GLOB_RECURSE SRCS "main.cpp" "*.cpp" "*.c" "ui/**/*.cpp" "ui/**/*.c" "external/**/*.cpp" "external/**/*.c")
# Start the source list with the known root source
set(SRCS "${CMAKE_CURRENT_LIST_DIR}/main.cpp")
# Delegate source collection to per-directory CMakeLists (non-recursive)
set(SUBDIRS "display" "external" "ui" "io" "network" "info" "common")
foreach(dir IN LISTS SUBDIRS)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${dir}/CMakeLists.txt")
include("${CMAKE_CURRENT_LIST_DIR}/${dir}/CMakeLists.txt")
else()
file(GLOB DIR_SRCS "${CMAKE_CURRENT_LIST_DIR}/${dir}/*.c" "${CMAKE_CURRENT_LIST_DIR}/${dir}/*.cpp")
if(DIR_SRCS)
list(APPEND SRCS ${DIR_SRCS})
endif()
endif()
endforeach()
# Path to the source JSON in this component