set(incs . include joyinside_ws_client)
set(srcs)

if (CONFIG_SYS_CPU0)
    message(STATUS "=== Building CPU0 for joyinside_wss ===")

    list(APPEND srcs
        app_main.c
        application.c
        audiobook.c
        wifi_connect.c
        joyinside_ws_client/joyinside_http_utils.c
        joyinside_ws_client/joyinside_utils.c
        joyinside_ws_client/joyinside_auth.c
        joyinside_ws_client/joyinside_ws_client.c
        audio_para.c
        joyinside_time_sync.c
        voice_start.c
        audio_stream_player.c
    )

    if (CONFIG_AUDIO_DEBUG_ENABLE)
        list(APPEND srcs audio_debug.c)
    endif()

    set(COMPONENT_REQUIRES
        bk_init
        lwip_intf_v2_1
        media_service
        multimedia
        avdk_utils
        mbedtls
        json
        bk_factory_config
        bk_led_blink
        bk_motor
        bk_websocket
        webclient
    )

elseif (CONFIG_SYS_CPU1)
    message(STATUS "=== Building CPU1 for joyinside_wss ===")

    list(APPEND srcs
        app_main_cpu1.c
    )

    set(COMPONENT_REQUIRES
        bk_init
        media_service
        multimedia
    )

elseif (CONFIG_SYS_CPU2)
    message(STATUS "=== Building CPU2 for joyinside_wss ===")

    list(APPEND srcs
        app_main_cpu2.c
    )

    set(COMPONENT_REQUIRES
        bk_init
    )
endif()

if (CONFIG_OVERRIDE_FLASH_PARTITION)
    list(APPEND srcs
        vendor_flash.c
    )
endif()

armino_component_register(SRCS "${srcs}"
    INCLUDE_DIRS "${incs}"
    PRIV_REQUIRES ${COMPONENT_REQUIRES}
)

if (CONFIG_SYS_CPU0)
    set_source_files_properties(
        application.c
        voice_start.c
        joyinside_ws_client/joyinside_ws_client.c
        PROPERTIES COMPILE_OPTIONS "-O2"
    )
endif()
