Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CMakeLists.txt 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # ----------------------------------------------------------------------------
  2. # Copyright (c) 2024 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. # initialize pico-sdk from submodule
  18. include(pico-sdk/pico_sdk_init.cmake)
  19. project(gadget C CXX)
  20. set(CMAKE_C_STANDARD 11)
  21. set(CMAKE_CXX_STANDARD 17)
  22. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  23. # initialize the Raspberry Pi Pico SDK
  24. pico_sdk_init()
  25. add_executable(drumkit)
  26. target_sources(drumkit PUBLIC
  27. src/adc.c
  28. src/buttons.c
  29. src/encoder.c
  30. src/lcd.c
  31. src/led.c
  32. src/logo.c
  33. src/main.c
  34. src/pulse.c
  35. src/sequence.c
  36. src/ui.c
  37. pico-ssd1306/ssd1306.c
  38. )
  39. # external dependency include directories
  40. target_include_directories(drumkit PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  41. target_include_directories(drumkit PUBLIC ${CMAKE_CURRENT_LIST_DIR}/pico-ssd1306)
  42. # enable generous warnings
  43. target_compile_options(drumkit PUBLIC
  44. -Wall
  45. -Wextra
  46. -Werror
  47. -Wshadow
  48. -O3
  49. )
  50. # suppress some warnings for borked 3rd party files in Pico SDK
  51. set_source_files_properties(pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  52. set_source_files_properties(pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  53. set_source_files_properties(pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  54. set_source_files_properties(pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  55. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  56. set_source_files_properties(pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  57. set_source_files_properties(pico-sdk/src/rp2_common/hardware_flash/flash.c PROPERTIES COMPILE_FLAGS -Wno-shadow)
  58. # pull in common dependencies
  59. target_link_libraries(drumkit
  60. pico_stdlib
  61. hardware_i2c
  62. hardware_adc
  63. hardware_gpio
  64. hardware_pwm
  65. )
  66. # enable usb output, disable uart output
  67. pico_enable_stdio_usb(drumkit 1)
  68. pico_enable_stdio_uart(drumkit 0)
  69. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  70. target_compile_definitions(drumkit PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  71. pico_add_extra_outputs(drumkit)