No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. cmake_minimum_required(VERSION 3.13)
  2. # initialize pico-sdk from submodule
  3. # note: this must happen before project()
  4. include(pico-sdk/pico_sdk_init.cmake)
  5. project(trackball)
  6. # initialize the Raspberry Pi Pico SDK
  7. pico_sdk_init()
  8. # copy FatFS source files to build dir, so we can use our own ffconf.h
  9. configure_file(
  10. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  11. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  12. COPYONLY
  13. )
  14. configure_file(
  15. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  16. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  17. COPYONLY
  18. )
  19. configure_file(
  20. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  21. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  22. COPYONLY
  23. )
  24. configure_file(
  25. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  26. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  27. COPYONLY
  28. )
  29. add_executable(trackball)
  30. target_sources(trackball PUBLIC
  31. src/main.c
  32. src/console.c
  33. src/log.c
  34. src/util.c
  35. src/pmw3360.c
  36. src/usb.c
  37. src/usb_cdc.c
  38. src/usb_descriptors.c
  39. src/usb_hid.c
  40. src/usb_msc.c
  41. src/fat_disk.c
  42. src/debug.c
  43. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  44. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  45. )
  46. # Make sure TinyUSB can find tusb_config.h
  47. target_include_directories(trackball PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  48. # Make sure FatFS can find ffconf.h
  49. target_include_directories(trackball PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  50. target_compile_options(trackball PUBLIC
  51. -Wall
  52. -Wextra
  53. -Werror
  54. )
  55. # pull in common dependencies
  56. target_link_libraries(trackball
  57. pico_stdlib
  58. pico_unique_id
  59. tinyusb_device
  60. tinyusb_board
  61. hardware_spi
  62. )
  63. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  64. target_compile_definitions(trackball PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  65. # create map/bin/hex/uf2 file etc.
  66. pico_add_extra_outputs(trackball)