cmake_minimum_required(VERSION 3.25.1)
include(pico_sdk_import.cmake)
include(pico_extras_import.cmake)
project(Danger-alarm CXX C ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()


add_subdirectory(Lib/pico-onewire)

add_executable(
    Danger-alarm
)

pico_generate_pio_header(Danger-alarm ${CMAKE_CURRENT_LIST_DIR}/Source/uart_tx.pio)
pico_generate_pio_header(Danger-alarm ${CMAKE_CURRENT_LIST_DIR}/Source/uart_rx.pio)

target_sources(Danger-alarm PRIVATE 
    Lib/radio-switch.cc
    ${CMAKE_CURRENT_LIST_DIR}/Source/common.c
    ${CMAKE_CURRENT_LIST_DIR}/Source/MAIN.cpp
    ${CMAKE_CURRENT_LIST_DIR}/Source/DTH11.cpp
    ${CMAKE_CURRENT_LIST_DIR}/Source/HC-12.cpp
    ${CMAKE_CURRENT_LIST_DIR}/Source/ZC13.cpp
)

pico_enable_stdio_uart(Danger-alarm 1)
pico_enable_stdio_usb(Danger-alarm 1)
pico_add_extra_outputs(Danger-alarm)

target_include_directories(Danger-alarm PRIVATE
        ${CMAKE_CURRENT_LIST_DIR}
        ${CMAKE_CURRENT_LIST_DIR}/Source
        ${CMAKE_CURRENT_LIST_DIR}/lib
        )

target_link_libraries(
    Danger-alarm
    pico_stdlib
    pico_runtime
    pico_multicore
    pico_one_wire
    hardware_sleep
    hardware_rtc
    hardware_i2c
    hardware_uart
    hardware_pwm
    hardware_adc
    hardware_pio
    pico_lwip
    pico_cyw43_arch
    pico_cyw43_arch_lwip_poll
)
