S&B Volcano vaporizer remote control with Pi Pico W
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 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. cmake_minimum_required(VERSION 3.13)
  2. # build MCUFont encoder host tool and convert included example fonts
  3. execute_process(COMMAND make
  4. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/encoder
  5. )
  6. execute_process(COMMAND make
  7. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/fonts
  8. )
  9. # initialize pico-sdk from submodule
  10. include(pico-sdk/pico_sdk_init.cmake)
  11. project(gadget C CXX)
  12. set(CMAKE_C_STANDARD 11)
  13. set(CMAKE_CXX_STANDARD 17)
  14. # initialize the Raspberry Pi Pico SDK
  15. pico_sdk_init()
  16. # copy FatFS source files to build dir, so we can use our own ffconf.h
  17. configure_file(
  18. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  19. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  20. COPYONLY
  21. )
  22. configure_file(
  23. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  24. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  25. COPYONLY
  26. )
  27. configure_file(
  28. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  29. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  30. COPYONLY
  31. )
  32. configure_file(
  33. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  34. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  35. COPYONLY
  36. )
  37. add_executable(gadget)
  38. target_sources(gadget PUBLIC
  39. src/main.c
  40. src/console.c
  41. src/log.c
  42. src/util.c
  43. src/usb.c
  44. src/usb_cdc.c
  45. src/usb_descriptors.c
  46. src/usb_msc.c
  47. src/fat_disk.c
  48. src/debug_disk.c
  49. src/buttons.c
  50. src/lipo.c
  51. src/ble.c
  52. src/lcd.c
  53. src/text.c
  54. src/image.c
  55. src/state.c
  56. src/volcano.c
  57. src/serial.c
  58. src/ring.c
  59. src/models.c
  60. src/state_scan.c
  61. src/workflow.c
  62. src/menu.c
  63. src/state_volcano_workflow.c
  64. src/state_volcano_run.c
  65. src/crafty.c
  66. src/state_crafty.c
  67. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  68. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  69. st7789/src/driver_st7789.c
  70. mcufont/decoder/mf_encoding.c
  71. mcufont/decoder/mf_font.c
  72. mcufont/decoder/mf_justify.c
  73. mcufont/decoder/mf_kerning.c
  74. mcufont/decoder/mf_rlefont.c
  75. mcufont/decoder/mf_bwfont.c
  76. mcufont/decoder/mf_scaledfont.c
  77. mcufont/decoder/mf_wordwrap.c
  78. )
  79. # external dependency include directories
  80. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  81. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  82. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/src)
  83. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/interface)
  84. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/decoder)
  85. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/fonts)
  86. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/build)
  87. # compress source code and stuff we want to include
  88. add_custom_target(pack bash -c "./pack_data.sh"
  89. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  90. BYPRODUCTS "build/pack_data.h"
  91. )
  92. add_dependencies(gadget pack)
  93. # enable generous warnings
  94. target_compile_options(gadget PUBLIC
  95. -Wall
  96. -Wextra
  97. -Werror
  98. )
  99. # suppress some warnings for borked 3rd party files in Pico SDK
  100. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  101. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  102. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  103. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  104. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  105. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  106. # pull in common dependencies
  107. target_link_libraries(gadget
  108. pico_stdlib
  109. pico_unique_id
  110. tinyusb_device
  111. tinyusb_board
  112. hardware_spi
  113. hardware_adc
  114. hardware_gpio
  115. hardware_pwm
  116. pico_btstack_ble
  117. pico_btstack_cyw43
  118. pico_cyw43_arch_threadsafe_background
  119. )
  120. target_compile_definitions(gadget PUBLIC
  121. RUNNING_AS_CLIENT=1
  122. CYW43_LWIP=0
  123. )
  124. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  125. target_compile_definitions(gadget PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  126. # create map/bin/hex/uf2 file etc.
  127. pico_add_extra_outputs(gadget)