cmake_minimum_required(VERSION 3.13)

include(pico_sdk_import.cmake)

project(mtgcard)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(PICO_USE_FASTEST_SUPPORTED_CLOCK 1)

pico_sdk_init()

add_library(devicelib STATIC
  src/display.cpp
  src/flash.cpp
  src/devicelib.cpp
  src/pixelstream.cpp
  src/usb_descriptors.c
)

target_include_directories(devicelib PUBLIC include)

target_link_libraries(devicelib PUBLIC
  pico_stdlib
  hardware_spi
  hardware_dma
  hardware_clocks
  tinyusb_device
  tinyusb_board
  pico_unique_id
)

target_compile_definitions(devicelib PUBLIC
  PICO_ENTER_USB_BOOT_ON_EXIT=1
)

add_subdirectory(programs)
