core(M0): монорепо-каркас — CMake (posix+esp-idf), платслой, лог, мини-httpd
- CMakeLists в корне: ветвление ESP_PLATFORM (idf_component_register, lwip/esp_timer/esp_hw_support/pthread) / POSIX (статическая библиотека fgl-aircon, C++20, -fno-exceptions -fno-rtti, -Werror). - src/ayla/platform: сокеты/потоки/CSPRNG/время; posix (getrandom, poll, pthread_join) и esp-idf (lwip_select, esp_fill_random, pthread-слой IDF); tcp_shutdown/tcp_local_port/thread_join для управляемой остановки. - src/ayla: log (sink, без printf); мини-httpd/1.1 (keep-alive, Content-Length, лимиты заголовков/тела, ephemeral-порт, жизненный цикл с гарантией завершения потока: shutdown(active)→join→close). - tests/ayla: platform (join, loopback+shutdown) и httpd (404, keep-alive, обработчик/парсинг, oversize-400, stop при живом соединении, стрим заголовков). doctest через FetchContent. - scripts/ci.sh: сборка+ctest. ESP-IDF v5.5.5 esp32: смоук-сборка с ядром как компонентом — Project build complete. Ревью под-агентом: 3 круга, все блокеры (жизненный цикл httpd) закрыты, APPROVED.
This commit is contained in:
57
CMakeLists.txt
Normal file
57
CMakeLists.txt
Normal file
@@ -0,0 +1,57 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(ESP_PLATFORM)
|
||||
# ---------------------------------------------------------------------------
|
||||
# Сборка как компонента ESP-IDF (корень репозитория = компонент; имя
|
||||
# компонента = имя каталога, из которого он подключён).
|
||||
# ВАЖНО: cmake_minimum_required должен остаться до этой ветки, project()
|
||||
# для IDF-сборки не вызывается.
|
||||
# ---------------------------------------------------------------------------
|
||||
idf_component_register(
|
||||
SRCS
|
||||
"src/ayla/httpd.cpp"
|
||||
"src/ayla/log.cpp"
|
||||
"src/ayla/platform/esp-idf/platform.cpp"
|
||||
INCLUDE_DIRS
|
||||
"include"
|
||||
PRIV_INCLUDE_DIRS
|
||||
"src"
|
||||
PRIV_REQUIRES
|
||||
lwip
|
||||
esp_timer
|
||||
esp_hw_support
|
||||
pthread
|
||||
)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE
|
||||
-Wall -Wextra -Werror
|
||||
-fno-exceptions -fno-rtti
|
||||
)
|
||||
target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_20)
|
||||
else()
|
||||
# ---------------------------------------------------------------------------
|
||||
# Обычная (POSIX) сборка: статическая библиотека + тесты.
|
||||
# ---------------------------------------------------------------------------
|
||||
project(fgl-aircon VERSION 0.1.0 LANGUAGES CXX)
|
||||
|
||||
option(FGL_BUILD_TESTS "Build tests" ON)
|
||||
|
||||
add_library(fgl-aircon STATIC
|
||||
src/ayla/httpd.cpp
|
||||
src/ayla/log.cpp
|
||||
src/ayla/platform/posix/platform.cpp
|
||||
)
|
||||
target_include_directories(fgl-aircon
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
)
|
||||
target_compile_features(fgl-aircon PUBLIC cxx_std_20)
|
||||
target_compile_options(fgl-aircon PRIVATE
|
||||
-Wall -Wextra -Werror
|
||||
-fno-exceptions -fno-rtti
|
||||
)
|
||||
|
||||
if(FGL_BUILD_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
endif()
|
||||
Reference in New Issue
Block a user