Açıklama Yok
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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.5)
  17. # initialize pico-sdk from submodule
  18. include(pico-sdk/pico_sdk_init.cmake)
  19. project(dispensy 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(dispensy)
  26. target_sources(dispensy PUBLIC
  27. ${CMAKE_CURRENT_LIST_DIR}/src/main.c
  28. ${CMAKE_CURRENT_LIST_DIR}/src/console.c
  29. ${CMAKE_CURRENT_LIST_DIR}/src/log.c
  30. ${CMAKE_CURRENT_LIST_DIR}/src/util.c
  31. ${CMAKE_CURRENT_LIST_DIR}/src/usb.c
  32. ${CMAKE_CURRENT_LIST_DIR}/src/usb_cdc.c
  33. ${CMAKE_CURRENT_LIST_DIR}/src/usb_descriptors.c
  34. ${CMAKE_CURRENT_LIST_DIR}/src/buttons.c
  35. ${CMAKE_CURRENT_LIST_DIR}/src/lcd.c
  36. ${CMAKE_CURRENT_LIST_DIR}/src/ring.c
  37. ${CMAKE_CURRENT_LIST_DIR}/src/hw_id.c
  38. ${CMAKE_CURRENT_LIST_DIR}/src/can.c
  39. ${CMAKE_CURRENT_LIST_DIR}/pico-ssd1306/ssd1306.c
  40. ${CMAKE_CURRENT_LIST_DIR}/can2040/src/can2040.c
  41. )
  42. target_include_directories(dispensy PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  43. target_include_directories(dispensy PUBLIC ${CMAKE_CURRENT_LIST_DIR}/pico-ssd1306)
  44. target_include_directories(dispensy PUBLIC ${CMAKE_CURRENT_LIST_DIR}/can2040/src)
  45. target_include_directories(dispensy PUBLIC ${CMAKE_CURRENT_LIST_DIR}/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Include)
  46. target_include_directories(dispensy PUBLIC ${CMAKE_CURRENT_LIST_DIR}/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include)
  47. # enable generous warnings
  48. target_compile_options(dispensy PUBLIC
  49. -Wall
  50. -Wextra
  51. -Werror
  52. -O3
  53. -DSSD1306_DEBUG_PRINT=debug
  54. -DSSD1306_DEBUG_INCLUDE="log.h"
  55. )
  56. # suppress some warnings for borked 3rd party files in Pico SDK
  57. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/lib/btstack/src/ble/sm.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  58. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/lib/btstack/src/btstack_hid_parser.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized)
  59. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/src/rp2_common/pico_cyw43_driver/cyw43_driver.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  60. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/lib/btstack/src/classic/avdtp_util.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  61. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/lib/btstack/src/classic/goep_client.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  62. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/lib/btstack/src/classic/goep_server.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  63. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/pico-sdk/src/rp2_common/hardware_flash/flash.c PROPERTIES COMPILE_FLAGS -Wno-shadow)
  64. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/can2040/src/can2040.c PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
  65. # repo meta data
  66. include(FetchContent)
  67. FetchContent_Declare(cmake_git_version_tracking
  68. GIT_REPOSITORY https://github.com/andrew-hardin/cmake-git-version-tracking.git
  69. GIT_TAG 6c0cb87edd029ddfb403a8e24577c144a03605a6
  70. )
  71. FetchContent_MakeAvailable(cmake_git_version_tracking)
  72. # pull in common dependencies
  73. target_link_libraries(dispensy
  74. pico_stdlib
  75. pico_unique_id
  76. tinyusb_device
  77. tinyusb_board
  78. hardware_adc
  79. hardware_gpio
  80. hardware_i2c
  81. cmake_git_version_tracking
  82. )
  83. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  84. target_compile_definitions(dispensy PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  85. pico_add_extra_outputs(dispensy)