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 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # ----------------------------------------------------------------------------
  2. # Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # See <http://www.gnu.org/licenses/>.
  15. # ----------------------------------------------------------------------------
  16. cmake_minimum_required(VERSION 3.13)
  17. # build MCUFont encoder host tool and convert included example fonts
  18. execute_process(COMMAND make
  19. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/encoder
  20. )
  21. execute_process(COMMAND make
  22. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mcufont/fonts
  23. )
  24. # initialize pico-sdk from submodule
  25. include(pico-sdk/pico_sdk_init.cmake)
  26. project(gadget C CXX)
  27. set(CMAKE_C_STANDARD 11)
  28. set(CMAKE_CXX_STANDARD 17)
  29. # initialize the Raspberry Pi Pico SDK
  30. pico_sdk_init()
  31. # copy FatFS source files to build dir, so we can use our own ffconf.h
  32. configure_file(
  33. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  34. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  35. COPYONLY
  36. )
  37. configure_file(
  38. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  39. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  40. COPYONLY
  41. )
  42. configure_file(
  43. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  44. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  45. COPYONLY
  46. )
  47. configure_file(
  48. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  49. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  50. COPYONLY
  51. )
  52. add_executable(gadget)
  53. target_sources(gadget PUBLIC
  54. src/main.c
  55. src/console.c
  56. src/log.c
  57. src/util.c
  58. src/usb.c
  59. src/usb_cdc.c
  60. src/usb_descriptors.c
  61. src/usb_msc.c
  62. src/fat_disk.c
  63. src/debug_disk.c
  64. src/buttons.c
  65. src/lipo.c
  66. src/ble.c
  67. src/lcd.c
  68. src/text.c
  69. src/image.c
  70. src/state.c
  71. src/volcano.c
  72. src/serial.c
  73. src/ring.c
  74. src/models.c
  75. src/state_scan.c
  76. src/workflow.c
  77. src/menu.c
  78. src/state_volcano_workflow.c
  79. src/state_volcano_run.c
  80. src/crafty.c
  81. src/state_crafty.c
  82. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  83. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  84. st7789/src/driver_st7789.c
  85. mcufont/decoder/mf_encoding.c
  86. mcufont/decoder/mf_font.c
  87. mcufont/decoder/mf_justify.c
  88. mcufont/decoder/mf_kerning.c
  89. mcufont/decoder/mf_rlefont.c
  90. mcufont/decoder/mf_bwfont.c
  91. mcufont/decoder/mf_scaledfont.c
  92. mcufont/decoder/mf_wordwrap.c
  93. )
  94. # external dependency include directories
  95. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  96. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  97. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/src)
  98. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/st7789/interface)
  99. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/decoder)
  100. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mcufont/fonts)
  101. target_include_directories(gadget PUBLIC ${CMAKE_CURRENT_LIST_DIR}/build)
  102. # compress source code and stuff we want to include
  103. add_custom_target(pack bash -c "./pack_data.sh"
  104. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  105. BYPRODUCTS "build/pack_data.h"
  106. )
  107. add_dependencies(gadget pack)
  108. # enable generous warnings
  109. target_compile_options(gadget PUBLIC
  110. -Wall
  111. -Wextra
  112. -Werror
  113. )
  114. # suppress some warnings for borked 3rd party files in Pico SDK
  115. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  116. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  117. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  118. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  119. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  120. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  121. # pull in common dependencies
  122. target_link_libraries(gadget
  123. pico_stdlib
  124. pico_unique_id
  125. tinyusb_device
  126. tinyusb_board
  127. hardware_spi
  128. hardware_adc
  129. hardware_gpio
  130. hardware_pwm
  131. pico_btstack_ble
  132. pico_btstack_cyw43
  133. pico_cyw43_arch_threadsafe_background
  134. )
  135. target_compile_definitions(gadget PUBLIC
  136. RUNNING_AS_CLIENT=1
  137. CYW43_LWIP=0
  138. )
  139. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  140. target_compile_definitions(gadget PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  141. # create map/bin/hex/uf2 file etc.
  142. pico_add_extra_outputs(gadget)