251 lines
7.2 KiB
CMake
251 lines
7.2 KiB
CMake
set(platform_srcs
|
|
"src/runtime/platform_core_runtime.c"
|
|
"src/runtime/platform_storage.c"
|
|
"src/runtime/platform_time.c"
|
|
"src/runtime/platform_https_client.c"
|
|
"src/runtime/platform_ota.c"
|
|
"src/runtime/platform_lan_http_server.c"
|
|
"src/runtime/platform_ble_gatt_server.c"
|
|
"src/platform_console_driver.c"
|
|
"src/runtime/platform_behavior_runtime.c"
|
|
"src/runtime/platform_multimodal_runtime.c"
|
|
"src/runtime/platform_lcd_runtime.c"
|
|
"src/platform_stepper_driver.c"
|
|
"src/platform_battery_driver.c"
|
|
"src/platform_digital_input_driver.c"
|
|
"src/platform_io_effects.c"
|
|
"src/lcd_direct.c"
|
|
"src/generated/lcd_status_assets.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"
|
|
"src/multimodal/audio_pipeline.c"
|
|
"src/multimodal/transport_ws.c"
|
|
"src/wifi_portal_bridge.cpp"
|
|
"src/platform_behavior_stubs.c"
|
|
)
|
|
|
|
if(CONFIG_TQ_LCD_EMOTE_GFX_TEST)
|
|
list(APPEND platform_srcs
|
|
"src/lcd_emote_assets.c"
|
|
"src/lcd_emote_listening.c"
|
|
"src/lcd_emote_fortune.c"
|
|
"src/generated/emote_gfx/fortune_assets.c"
|
|
"src/generated/emote_gfx/idle_base.c"
|
|
"src/generated/emote_gfx/idle_eyes_open.c"
|
|
"src/generated/emote_gfx/listening_base.c"
|
|
"src/generated/emote_gfx/listening_eyes_open.c"
|
|
"src/generated/emote_gfx/listening_eyes_half.c"
|
|
"src/generated/emote_gfx/listening_eyes_closed.c"
|
|
)
|
|
endif()
|
|
|
|
set(platform_priv_requires
|
|
78__esp-wifi-connect
|
|
bt
|
|
cxx
|
|
driver
|
|
esp_audio_codec
|
|
esp_adc
|
|
esp_codec_dev
|
|
esp_driver_gpio
|
|
esp_driver_i2c
|
|
esp_driver_i2s
|
|
esp_driver_ledc
|
|
esp_driver_rmt
|
|
esp_driver_spi
|
|
esp_event
|
|
esp_app_format
|
|
app_update
|
|
esp_http_client
|
|
esp_http_server
|
|
esp_hw_support
|
|
esp_lcd
|
|
esp_netif
|
|
esp_psram
|
|
heap
|
|
esp_system
|
|
esp_timer
|
|
esp_wifi
|
|
esp_websocket_client
|
|
json
|
|
log
|
|
espressif__mdns
|
|
mbedtls
|
|
nvs_flash
|
|
)
|
|
|
|
if(CONFIG_TQ_NETWORK_DIAGNOSTICS_ENABLE)
|
|
list(APPEND platform_priv_requires lwip)
|
|
endif()
|
|
|
|
if(CONFIG_TQ_LCD_EMOTE_GFX_TEST)
|
|
list(APPEND platform_priv_requires espressif2022__esp_emote_gfx)
|
|
endif()
|
|
|
|
idf_component_register(
|
|
SRCS
|
|
${platform_srcs}
|
|
INCLUDE_DIRS
|
|
"include"
|
|
PRIV_INCLUDE_DIRS
|
|
"internal"
|
|
"third_party/lodepng"
|
|
PRIV_REQUIRES
|
|
${platform_priv_requires}
|
|
)
|
|
|
|
set_source_files_properties(
|
|
"third_party/lodepng/lodepng.cpp"
|
|
PROPERTIES
|
|
COMPILE_DEFINITIONS "LODEPNG_NO_COMPILE_ENCODER;LODEPNG_NO_COMPILE_DISK;LODEPNG_NO_COMPILE_CPP;LODEPNG_NO_COMPILE_ALLOCATORS"
|
|
)
|
|
|
|
set(platform_audio_prompt_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/assets/audio_prompts")
|
|
set(platform_lcd_asset_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/assets/lcd_source")
|
|
set(platform_lcd_asset_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/assets/lcd_optimized")
|
|
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"
|
|
)
|
|
file(GLOB platform_lcd_source_png_files CONFIGURE_DEPENDS
|
|
"${platform_lcd_asset_source_dir}/*.png"
|
|
)
|
|
set(platform_lcd_png_assets
|
|
buyunqian1
|
|
jichubiaoqing0
|
|
jichubiaoqing1
|
|
jichubiaoqing2
|
|
listening0
|
|
listening1
|
|
listening2
|
|
ota1
|
|
ota2
|
|
ota3
|
|
muyu0
|
|
muyu1
|
|
muyu2
|
|
chouqian_qianzhi0
|
|
chouqian_qianzhi1
|
|
chouqian_qianzhi2
|
|
chouqian_buyun0
|
|
chouqian_buyun1
|
|
chouqian_buyun2
|
|
chouqian_heping0
|
|
chouqian_heping1
|
|
chouqian_heping2
|
|
chouqian_shangshang0
|
|
chouqian_shangshang1
|
|
chouqian_shangshang2
|
|
chouqian_xiaoji0
|
|
chouqian_xiaoji1
|
|
chouqian_xiaoji2
|
|
chouqian_zhongshang0
|
|
chouqian_zhongshang1
|
|
chouqian_zhongshang2
|
|
qianzhiwuxing0
|
|
shui0
|
|
shui1
|
|
mu0
|
|
mu1
|
|
huo0
|
|
huo1
|
|
tu0
|
|
tu1
|
|
jin0
|
|
jin1
|
|
spin0
|
|
south0
|
|
southwest0
|
|
west0
|
|
northwest0
|
|
north0
|
|
northeast0
|
|
east0
|
|
southeast0
|
|
icon_shui0
|
|
icon_mu0
|
|
icon_huo0
|
|
icon_tu0
|
|
icon_jin0
|
|
charging
|
|
lowbat
|
|
qrcode
|
|
lcdtest00
|
|
lcdtest01
|
|
lcdtest02
|
|
lcdtest03
|
|
lcdtest04
|
|
lcdtest05
|
|
lcdtest06
|
|
lcdtest07
|
|
lcdtest08
|
|
lcdtest09
|
|
lcdtest10
|
|
lcdtest11
|
|
lcdtest12
|
|
lcdtest13
|
|
lcdtest14
|
|
lcdtest15
|
|
)
|
|
set(platform_lcd_png_asset_files)
|
|
foreach(lcd_png_asset IN LISTS platform_lcd_png_assets)
|
|
list(APPEND platform_lcd_png_asset_files
|
|
"${platform_lcd_asset_src_dir}/${lcd_png_asset}.png"
|
|
)
|
|
endforeach()
|
|
|
|
set(platform_asset_stage_commands)
|
|
foreach(audio_file IN LISTS platform_audio_prompt_files)
|
|
file(RELATIVE_PATH audio_rel_path "${platform_audio_prompt_src_dir}" "${audio_file}")
|
|
list(APPEND platform_asset_stage_commands
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${platform_asset_image_dir}/audio_prompts"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
"${audio_file}"
|
|
"${platform_asset_image_dir}/audio_prompts/${audio_rel_path}"
|
|
)
|
|
endforeach()
|
|
foreach(lcd_png_asset IN LISTS platform_lcd_png_assets)
|
|
list(APPEND platform_asset_stage_commands
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${platform_asset_image_dir}/lcd"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
"${platform_lcd_asset_src_dir}/${lcd_png_asset}.png"
|
|
"${platform_asset_image_dir}/lcd/${lcd_png_asset}.png"
|
|
)
|
|
endforeach()
|
|
|
|
# 先校验并暂存实际引用的 PNG/Opus,再由打包脚本生成应用内只读资源包。
|
|
add_custom_command(
|
|
OUTPUT "${platform_asset_stage_stamp}"
|
|
COMMAND ${PYTHON} "${platform_lcd_asset_optimizer}" check-current
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf "${platform_asset_image_dir}"
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${platform_asset_image_dir}"
|
|
${platform_asset_stage_commands}
|
|
COMMAND ${CMAKE_COMMAND} -E touch "${platform_asset_stage_stamp}"
|
|
DEPENDS
|
|
${platform_audio_prompt_files}
|
|
${platform_lcd_source_png_files}
|
|
${platform_lcd_png_asset_files}
|
|
"${platform_lcd_asset_manifest}"
|
|
"${platform_lcd_asset_optimizer}"
|
|
)
|
|
|
|
# 素材或打包脚本变化时重新生成包,并通过二进制链接目标纳入 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)
|