-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (48 loc) · 1.83 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.13)
include (pico_sdk_import.cmake)
project(rp2040-macropad C CXX ASM)
set(TARGET_NAME macropad)
set(VERSION_MAJOR 0)
set(VERSION_MINOR 5)
set(VERSION_PATCH 1)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
add_executable(${TARGET_NAME})
configure_file(${CMAKE_CURRENT_LIST_DIR}/src/version.h.in version.h @ONLY)
pico_sdk_init()
add_subdirectory("./Pico-PIO-USB" pico_pio_usb)
pico_generate_pio_header(macropad ${CMAKE_CURRENT_LIST_DIR}/src/led/ws2812.pio)
pico_add_extra_outputs(${TARGET_NAME})
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/src/layers
${CMAKE_CURRENT_LIST_DIR}/src/led
${CMAKE_CURRENT_LIST_DIR}/src/usb)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/main.cpp
${CMAKE_CURRENT_LIST_DIR}/src/layer.cpp
${CMAKE_CURRENT_LIST_DIR}/src/keypad.cpp
${CMAKE_CURRENT_LIST_DIR}/src/led/led.cpp
${CMAKE_CURRENT_LIST_DIR}/src/usb/usb_host.cpp
${CMAKE_CURRENT_LIST_DIR}/src/usb/usb_device.cpp
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c)
target_compile_definitions(${TARGET_NAME} PRIVATE PIO_USB_USE_TINYUSB)
target_link_options(${TARGET_NAME} PRIVATE)
target_link_libraries(${TARGET_NAME} PRIVATE
pico_stdlib
pico_unique_id
pico_pio_usb
tinyusb_device
tinyusb_host)
# Use ws2812 rgb led on gp16
ADD_DEFINITIONS(-DUSE_RGB_LED)
# Use extra keys
# ADD_DEFINITIONS(-DUSE_EXTRA_KEYS_EPOMAKER_TH21)
# Upload firmware as part of the build process
# ADD_DEFINITIONS(-DUSE_CDC_DEVICE)
# add_custom_target(upload_firmware ALL
# COMMAND ${CMAKE_SOURCE_DIR}/tools/macropad-dfu.sh ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.uf2
# DEPENDS ${TARGET_NAME}
# COMMENT "Upload firmware")