# Copyright (2025) Beijing Volcano Engine Technology Ltd.
# SPDX-License-Identifier: Apache License 2.0

file(GLOB  APP_SRC  "./echoear_app/*.c")

set(COMPONENT_SRCS "conv_ai_embedded_kit.c configuration_ap.c network.c platform_client.c" )

if (CONFIG_PRINT_TASK_INFO)
    add_definitions(-DPRINT_TASK_INFO)
endif()

set(COMPONENT_ADD_INCLUDEDIRS .)
set(COMPONENT_EMBED_TXTFILES assets/wifi_configuration_ap.html)

set(COMPONENT_REQUIRES esp_http_client esp_http_server esp_wifi esp-tls mbedtls nvs_flash json espressif__gmf_ai_audio espressif__esp_board_manager espressif__esp_lcd_touch)

register_component()

set(assets_root "${CMAKE_CURRENT_LIST_DIR}/../assets")

if(EXISTS "${assets_root}")
    spiffs_create_partition_assets(eaf "${assets_root}" FLASH_IN_PROJECT
        MMAP_FILE_SUPPORT_FORMAT ".eaf"
        IMPORT_INC_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
    add_dependencies(${COMPONENT_LIB} assets_eaf_bin)
    # The application component includes mmap_generate_eaf.h, which is emitted by
    # the assets generator into this directory.  Make that relationship explicit
    # so a clean parallel build cannot compile the display source too early.
    idf_component_get_property(application_lib application COMPONENT_LIB)
    add_dependencies(${application_lib} assets_eaf_bin)
endif()

set(COMPONENT_ADD_INCLUDEDIRS . ${FRAMEWORK_INC} ${SERVICE_INC})
