cmake_minimum_required(VERSION 3.10)

project(whd)

if(DEFINED WHD_EXTERNAL_PATH)
    set(WHD_EXTERNAL_INCS
        "${WHD_EXTERNAL_PATH}/bsp"
        "${WHD_EXTERNAL_PATH}/hal"
        "${WHD_EXTERNAL_PATH}/rtos"
    )
else()
    set(WHD_EXTERNAL_INCS
        "wifi-host-driver/External/bsp"
        "wifi-host-driver/External/hal"
        "wifi-host-driver/External/rtos"
    )
    message(WARNING "No WHD_EXTERNAL_PATH defined, using default.")
endif()

set(WHD_SOURCES
    "wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus.c"
    "wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_common.c"
    "wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_m2m_protocol.c"
    "wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_sdio_protocol.c"
    "wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_spi_protocol.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_ap.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_buffer_api.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_cdc_bdc.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_chip.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_chip_constants.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_clm.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_debug.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_events.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_logging.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_management.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_network_if.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_resource_if.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_sdpcm.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_thread.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_utils.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_wifi.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_wifi_api.c"
    "wifi-host-driver/WiFi_Host_Driver/src/whd_wifi_p2p.c"
)

set(WHD_INCLUDES
    ${WHD_EXTERNAL_INCS}
    ${WHD_RESOURCE_INCS}
    "wifi-host-driver/WiFi_Host_Driver/inc"
    "wifi-host-driver/WiFi_Host_Driver/src"
    "wifi-host-driver/WiFi_Host_Driver/src/include"
)

set(WHD_DEFINES
    ${WHD_INTERFACE_DEF}
)

add_library(${PROJECT_NAME} ${WHD_SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC ${WHD_INCLUDES})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${WHD_DEFINES})
