feat: Organize CMakeLists for modular source management across main components
This commit is contained in:
@@ -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
|
||||
|
||||
1
main/common/CMakeLists.txt
Normal file
1
main/common/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
# common/ currently contains headers; no sources to add by default
|
||||
5
main/display/CMakeLists.txt
Normal file
5
main/display/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/eink_display_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/epd_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/lvgl_handler.cpp"
|
||||
)
|
||||
6
main/external/CMakeLists.txt
vendored
Normal file
6
main/external/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/mtr/mtr.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/mtr/station_info.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/mtr/line_info.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/mtr/arrival.cpp"
|
||||
)
|
||||
3
main/info/CMakeLists.txt
Normal file
3
main/info/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/info.cpp"
|
||||
)
|
||||
4
main/io/CMakeLists.txt
Normal file
4
main/io/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fs_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/nvs_handler.cpp"
|
||||
)
|
||||
7
main/network/CMakeLists.txt
Normal file
7
main/network/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/http_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/wifi_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/web_server_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/udp_client.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/network.cpp"
|
||||
)
|
||||
14
main/ui/CMakeLists.txt
Normal file
14
main/ui/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ui_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/root_layout.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/interaction_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/events.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/apps/registry.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/widgets/textarea.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/widgets/button.cpp"
|
||||
)
|
||||
|
||||
# Apps control: include apps/CMakeLists.txt which selects which apps to add
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/apps/CMakeLists.txt")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/apps/CMakeLists.txt")
|
||||
endif()
|
||||
19
main/ui/apps/CMakeLists.txt
Normal file
19
main/ui/apps/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
# Control which apps are included in the build.
|
||||
# Override `ENABLED_APPS` from the top-level CMake command line to change apps.
|
||||
if(NOT DEFINED ENABLED_APPS)
|
||||
set(ENABLED_APPS "iotdis")
|
||||
endif()
|
||||
message(STATUS "Enabled apps: ${ENABLED_APPS}")
|
||||
|
||||
foreach(app IN LISTS ENABLED_APPS)
|
||||
set(APP_DIR "${CMAKE_CURRENT_LIST_DIR}/${app}")
|
||||
if(EXISTS "${APP_DIR}/CMakeLists.txt")
|
||||
include("${APP_DIR}/CMakeLists.txt")
|
||||
else()
|
||||
message(WARNING "App '${app}' has no CMakeLists.txt — attempting to add any sources directly")
|
||||
file(GLOB APP_SRCS "${APP_DIR}/*.c" "${APP_DIR}/*.cpp" "${APP_DIR}/*/*.c" "${APP_DIR}/*/*.cpp")
|
||||
if(APP_SRCS)
|
||||
list(APPEND SRCS ${APP_SRCS})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
12
main/ui/apps/iotdis/CMakeLists.txt
Normal file
12
main/ui/apps/iotdis/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# Explicit list of iotdis app sources
|
||||
list(APPEND SRCS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/web/web_handlers.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/descriptor.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/settings/settings_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/app.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/bridge/bridge.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ui/settings_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ui/settings.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ui/main_handler.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ui/main.cpp"
|
||||
)
|
||||
Reference in New Issue
Block a user