feat(assets): embed LCD and audio resources in OTA app
This commit is contained in:
@@ -16,6 +16,7 @@ set(platform_srcs
|
||||
"src/platform_io_effects.c"
|
||||
"src/lcd_direct.c"
|
||||
"src/lcd_direct_assets.c"
|
||||
"src/platform_asset_bundle.c"
|
||||
"third_party/lodepng/lodepng.cpp"
|
||||
"third_party/lodepng/lodepng_esp_alloc.cpp"
|
||||
"third_party/lodepng/lodepng_esp_bridge.cpp"
|
||||
@@ -54,7 +55,6 @@ set(platform_priv_requires
|
||||
esp_wifi
|
||||
esp_websocket_client
|
||||
json
|
||||
littlefs
|
||||
log
|
||||
espressif__mdns
|
||||
mbedtls
|
||||
@@ -90,6 +90,8 @@ set(platform_lcd_asset_manifest "${platform_lcd_asset_src_dir}/manifest.json")
|
||||
set(platform_lcd_asset_optimizer "${CMAKE_CURRENT_SOURCE_DIR}/../../tools/optimize_lcd_assets.py")
|
||||
set(platform_asset_image_dir "${CMAKE_CURRENT_BINARY_DIR}/asset_image")
|
||||
set(platform_asset_stage_stamp "${CMAKE_CURRENT_BINARY_DIR}/asset_image.stamp")
|
||||
set(platform_asset_pack "${CMAKE_CURRENT_BINARY_DIR}/platform_assets.pack")
|
||||
set(platform_asset_packer "${CMAKE_CURRENT_SOURCE_DIR}/../../tools/pack_embedded_assets.py")
|
||||
file(GLOB_RECURSE platform_audio_prompt_files CONFIGURE_DEPENDS
|
||||
"${platform_audio_prompt_src_dir}/*.opus"
|
||||
)
|
||||
@@ -199,6 +201,7 @@ foreach(lcd_png_asset IN LISTS platform_lcd_png_assets)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# 先校验并暂存实际引用的 PNG/Opus,再由打包脚本生成应用内只读资源包。
|
||||
add_custom_command(
|
||||
OUTPUT "${platform_asset_stage_stamp}"
|
||||
COMMAND ${PYTHON} "${platform_lcd_asset_optimizer}" check-current
|
||||
@@ -214,9 +217,14 @@ add_custom_command(
|
||||
"${platform_lcd_asset_optimizer}"
|
||||
)
|
||||
|
||||
littlefs_create_partition_image(
|
||||
gifpack
|
||||
"${platform_asset_image_dir}"
|
||||
FLASH_IN_PROJECT
|
||||
DEPENDS "${platform_asset_stage_stamp}"
|
||||
# 素材或打包脚本变化时重新生成包,并通过二进制链接目标纳入 OTA 应用镜像。
|
||||
add_custom_command(
|
||||
OUTPUT "${platform_asset_pack}"
|
||||
COMMAND ${PYTHON} "${platform_asset_packer}"
|
||||
"${platform_asset_image_dir}" "${platform_asset_pack}"
|
||||
DEPENDS "${platform_asset_stage_stamp}" "${platform_asset_packer}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
target_add_binary_data(${COMPONENT_LIB} "${platform_asset_pack}" BINARY
|
||||
RENAME_TO platform_assets_pack)
|
||||
|
||||
Reference in New Issue
Block a user