feat: 添加编译时模块开关配置
通过 sdkconfig.defaults 选择性启用/禁用模块,减少固件体积: 新增模块开关: - CONFIG_MIMI_CHAN_TELEGRAM (默认 n) - CONFIG_MIMI_CHAN_FEISHU (默认 y) - CONFIG_MIMI_TOOL_WEB_SEARCH (默认 y) - CONFIG_MIMI_TOOL_GPIO (默认 n) - CONFIG_MIMI_WS_SERVER (默认 y) - CONFIG_MIMI_WIFI_ONBOARD (默认 y) - CONFIG_MIMI_OTA (默认 n) 技术实现: - CMakeLists.txt 条件编译源文件 - 头文件使用 static inline stub - CLI 命令和工具注册也支持条件编译 消除 Telegram 未配置时的 5 秒轮询警告日志
This commit is contained in:
@@ -1,34 +1,65 @@
|
||||
# MimiClaw - CMake build configuration
|
||||
# This file is processed by ESP-IDF's CMake build system
|
||||
|
||||
# ─── Core modules (always compiled) ────────────────────────────────────────
|
||||
set(core_srcs
|
||||
"mimi.c"
|
||||
"bus/message_bus.c"
|
||||
"wifi/wifi_manager.c"
|
||||
"llm/llm_proxy.c"
|
||||
"llm/llm_provider.c"
|
||||
"agent/agent_loop.c"
|
||||
"agent/context_builder.c"
|
||||
"memory/memory_store.c"
|
||||
"memory/session_mgr.c"
|
||||
"cli/serial_cli.c"
|
||||
"proxy/http_proxy.c"
|
||||
"cron/cron_service.c"
|
||||
"heartbeat/heartbeat.c"
|
||||
"tools/tool_registry.c"
|
||||
"tools/tool_cron.c"
|
||||
"tools/tool_get_time.c"
|
||||
"tools/tool_set_timezone.c"
|
||||
"tools/tool_files.c"
|
||||
"skills/skill_loader.c"
|
||||
)
|
||||
|
||||
# ─── Channel modules ───────────────────────────────────────────────────────
|
||||
if(CONFIG_MIMI_CHAN_TELEGRAM)
|
||||
list(APPEND core_srcs "channels/telegram/telegram_bot.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_MIMI_CHAN_FEISHU)
|
||||
list(APPEND core_srcs "channels/feishu/feishu_bot.c")
|
||||
endif()
|
||||
|
||||
# ─── Optional modules ───────────────────────────────────────────────────────
|
||||
if(CONFIG_MIMI_WS_SERVER)
|
||||
list(APPEND core_srcs "gateway/ws_server.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_MIMI_WIFI_ONBOARD)
|
||||
list(APPEND core_srcs "onboard/wifi_onboard.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_MIMI_OTA)
|
||||
list(APPEND core_srcs "ota/ota_manager.c")
|
||||
endif()
|
||||
|
||||
# ─── Tool modules ──────────────────────────────────────────────────────────
|
||||
if(CONFIG_MIMI_TOOL_WEB_SEARCH)
|
||||
list(APPEND core_srcs "tools/tool_web_search.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_MIMI_TOOL_GPIO)
|
||||
list(APPEND core_srcs "tools/tool_gpio.c")
|
||||
list(APPEND core_srcs "tools/gpio_policy.c")
|
||||
endif()
|
||||
|
||||
# ─── Register component ───────────────────────────────────────────────────
|
||||
idf_component_register(
|
||||
SRCS
|
||||
"mimi.c"
|
||||
"bus/message_bus.c"
|
||||
"wifi/wifi_manager.c"
|
||||
"channels/telegram/telegram_bot.c"
|
||||
"channels/feishu/feishu_bot.c"
|
||||
"llm/llm_proxy.c"
|
||||
"llm/llm_provider.c"
|
||||
"agent/agent_loop.c"
|
||||
"agent/context_builder.c"
|
||||
"memory/memory_store.c"
|
||||
"memory/session_mgr.c"
|
||||
"gateway/ws_server.c"
|
||||
"cli/serial_cli.c"
|
||||
"proxy/http_proxy.c"
|
||||
"cron/cron_service.c"
|
||||
"heartbeat/heartbeat.c"
|
||||
"tools/tool_registry.c"
|
||||
"tools/tool_cron.c"
|
||||
"tools/tool_web_search.c"
|
||||
"tools/tool_get_time.c"
|
||||
"tools/tool_set_timezone.c"
|
||||
"tools/tool_files.c"
|
||||
"tools/tool_gpio.c"
|
||||
"tools/gpio_policy.c"
|
||||
"skills/skill_loader.c"
|
||||
"onboard/wifi_onboard.c"
|
||||
"ota/ota_manager.c"
|
||||
INCLUDE_DIRS
|
||||
"."
|
||||
SRCS ${core_srcs}
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES
|
||||
nvs_flash esp_wifi esp_netif esp_http_client esp_http_server
|
||||
esp_https_ota esp_event cjson spiffs console vfs app_update esp-tls
|
||||
|
||||
Reference in New Issue
Block a user