暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CMakeLists.txt 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. src/buttons.c
  44. src/controls.c
  45. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  46. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  47. )
  48. # Make sure TinyUSB can find tusb_config.h
  49. target_include_directories(trackball PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  50. # Make sure FatFS can find ffconf.h
  51. target_include_directories(trackball PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  52. target_compile_options(trackball PUBLIC
  53. -Wall
  54. -Wextra
  55. -Werror
  56. )
  57. # pull in common dependencies
  58. target_link_libraries(trackball
  59. pico_stdlib
  60. pico_unique_id
  61. tinyusb_device
  62. tinyusb_board
  63. hardware_spi
  64. )
  65. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  66. target_compile_definitions(trackball PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  67. # create map/bin/hex/uf2 file etc.
  68. pico_add_extra_outputs(trackball)