CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Generated Cmake Pico project file
  2. cmake_minimum_required(VERSION 3.13)
  3. set(CMAKE_C_STANDARD 11)
  4. set(CMAKE_CXX_STANDARD 17)
  5. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  6. # Initialise pico_sdk from installed location
  7. # (note this can come from environment, CMake cache etc)
  8. # == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
  9. if(WIN32)
  10. set(USERHOME $ENV{USERPROFILE})
  11. else()
  12. set(USERHOME $ENV{HOME})
  13. endif()
  14. set(sdkVersion 2.1.0)
  15. set(toolchainVersion 13_3_Rel1)
  16. set(picotoolVersion 2.1.0)
  17. set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
  18. if (EXISTS ${picoVscode})
  19. include(${picoVscode})
  20. endif()
  21. # ====================================================================================
  22. set(PICO_BOARD pico2 CACHE STRING "Board type")
  23. # Pull in Raspberry Pi Pico SDK (must be before project)
  24. include(pico_sdk_import.cmake)
  25. project(usb_keypad1 C CXX ASM)
  26. # Initialize the Raspberry Pi Pico SDK
  27. pico_sdk_init()
  28. # Add executable. Default name is the project name, version 0.1
  29. add_executable(usb_keypad1 usb_keypad1.c keypad.c usb_descriptors.c display.c sd1306.c)
  30. pico_set_program_name(usb_keypad1 "usb_keypad1")
  31. pico_set_program_version(usb_keypad1 "0.1")
  32. # Generate PIO header
  33. pico_generate_pio_header(usb_keypad1 ${CMAKE_CURRENT_LIST_DIR}/keypad_scanner.pio)
  34. # Modify the below lines to enable/disable output over UART/USB
  35. pico_enable_stdio_uart(usb_keypad1 0)
  36. pico_enable_stdio_usb(usb_keypad1 0)
  37. # Add the standard library to the build
  38. target_link_libraries(usb_keypad1
  39. pico_stdlib)
  40. # Add the standard include files to the build
  41. target_include_directories(usb_keypad1 PRIVATE
  42. ${CMAKE_CURRENT_LIST_DIR}
  43. )
  44. # Add any user requested libraries
  45. target_link_libraries(usb_keypad1
  46. hardware_pio
  47. pico_stdlib
  48. pico_unique_id
  49. tinyusb_device
  50. tinyusb_board
  51. hardware_i2c
  52. pico_multicore
  53. )
  54. pico_add_extra_outputs(usb_keypad1)