cmake_minimum_required(VERSION 3.13)

include(pico_sdk_import.cmake)

project(VL53L8CX C CXX ASM)
set(CMAKE_C_STNDARD 11)
set(CMAKE_CXX_STANDARD 17)

set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR})

pico_sdk_init()

add_executable(VL53L8CX
  main.c
  VL53L8CX_ULD_API/src/vl53l8cx_api.c
  VL53L8CX_ULD_API/src/vl53l8cx_plugin_detection_thresholds.c
  VL53L8CX_ULD_API/src/vl53l8cx_plugin_motion_indicator.c
  VL53L8CX_ULD_API/src/vl53l8cx_plugin_xtalk.c
  Platform/platform.c
)

target_include_directories(VL53L8CX PRIVATE VL53L8CX_ULD_API/inc/)

target_link_libraries(VL53L8CX
  hardware_i2c 
  hardware_uart 
  pico_stdlib
  pico_multicore
)

pico_enable_stdio_usb(VL53L8CX 1)
pico_enable_stdio_uart(VL53L8CX 1)

pico_add_extra_outputs(VL53L8CX)

add_custom_target(Flash
    DEPENDS VL53L8CX
    COMMAND sudo picotool load -f ${PROJECT_BINARY_DIR}/VL53L8CX.uf2
)
