Merge branch 'display' into feature/mtr-app

This commit is contained in:
GW_MC
2026-01-24 13:31:18 +08:00
38 changed files with 3475 additions and 2028 deletions

View File

@@ -1,39 +1,24 @@
set(requires esp-tls spi_flash nvs_flash esp_event esp_netif esp_http_client esp_wifi esp_psram)
file(GLOB SRCS "main.cpp" "*.cpp" "*.c" "**/*.cpp" "**/*.c")
# Path to the source JSON in this component
set(ASSETS_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/../assets)
set(ASSETS_BINARY_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/assets)
set(MTR_JSON_SRC ${ASSETS_SRC_DIR}/MTR_LINE_STATION.json)
set(MTR_JSON_HEADER ${ASSETS_BINARY_OUTPUT_DIR}/MTR_LINE_STATION.h)
set(CUSTOM_CMAKE_MODULES_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake)
## Generate a minified header at configure time using Python
find_package(Python3 COMPONENTS Interpreter)
file(MAKE_DIRECTORY ${ASSETS_BINARY_OUTPUT_DIR})
if (Python3_Interpreter_FOUND)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import json,sys,io; sys.stdout.write(json.dumps(json.load(open(sys.argv[1], 'r', encoding='utf-8')),separators=(',',':')))"
"${MTR_JSON_SRC}"
RESULT_VARIABLE _mtr_json_minify_result
OUTPUT_VARIABLE MTR_JSON_MINIFIED
ERROR_VARIABLE _mtr_json_minify_error
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (_mtr_json_minify_result)
message(WARNING "Python minify failed (code=${_mtr_json_minify_result}): ${_mtr_json_minify_error}\nEmbedding original ${MTR_JSON_SRC} instead.")
file(READ ${MTR_JSON_SRC} MTR_JSON_MINIFIED)
elseif (NOT MTR_JSON_MINIFIED)
message(WARNING "Python minified output empty; embedding original ${MTR_JSON_SRC} instead.")
file(READ ${MTR_JSON_SRC} MTR_JSON_MINIFIED)
endif()
else()
message(WARNING "Python3 not found; embedding original JSON without minification.")
file(READ ${MTR_JSON_SRC} MTR_JSON_MINIFIED)
endif()
file(WRITE ${MTR_JSON_HEADER} "#pragma once\nstatic const char MTR_LINE_STATION_JSON[] = R\"json(${MTR_JSON_MINIFIED})json\";\n")
set(requires esp-tls spi_flash nvs_flash esp_event esp_netif esp_http_client esp_wifi esp_psram esp_lvgl_port)
file(GLOB SRCS "main.cpp" "*.cpp" "*.c" "**/*.cpp" "**/*.cpp" "ui/**/*.cpp" "ui/**/*.c")
# Explicitly list all source files to ensure build system picks them up
# set(SRCS
# "main.cpp"
# "display/display.cpp"
# "display/eink_display_handler.cpp"
# "info/info.cpp"
# "io/nvs_handler.cpp"
# "network/http_handler.cpp"
# "network/network.cpp"
# "network/udp_client.cpp"
# "network/wifi_handler.cpp"
# "ui/page_stack.cpp"
# "ui/root_layout.cpp"
# "ui/ui_handler.cpp"
# "ui/apps/demo_app.cpp"
# "ui/apps/discord_app.cpp"
# "ui/apps/shutdown_app.cpp"
# )
idf_component_register(SRCS ${SRCS}
PRIV_REQUIRES ${requires}
INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" "display" "touch" "network" "ui" "io" "common" "external")
INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" "display" "network" "ui" "ui/apps" "io" "common" "external")