-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathCMakeLists.txt
115 lines (104 loc) · 2.74 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022, Input Labs Oy.
cmake_minimum_required(VERSION 3.16)
if (EXISTS ./deps/pico-sdk AND EXISTS ./deps/arm-toolchain)
# If the dependencies are local.
set(PICO_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/deps/pico-sdk)
set(PICO_TOOLCHAIN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/deps/arm-toolchain)
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
else()
# If the dependencies are global.
include(scripts/pico_sdk_import.cmake)
endif()
set(PROJECT alpakka)
set(PICO_BOARD pico)
project(${PROJECT} C CXX ASM)
pico_sdk_init()
add_executable(${PROJECT}
src/main.c
)
if(DEFINED DEVICE)
if(DEVICE MATCHES "alpakka_v0")
target_compile_definitions(${PROJECT} PUBLIC DEVICE_ALPAKKA_V0=1)
elseif(DEVICE MATCHES "alpakka_v1")
target_compile_definitions(${PROJECT} PUBLIC DEVICE_ALPAKKA_V1=1)
elseif(DEVICE MATCHES "dongle")
target_compile_definitions(${PROJECT} PUBLIC DEVICE_DONGLE=1)
elseif(DEVICE MATCHES "llama")
target_compile_definitions(${PROJECT} PUBLIC DEVICE_LLAMA=1)
else()
message(FATAL_ERROR "Target device unknown")
endif()
else()
message(FATAL_ERROR "Target device not defined")
endif()
target_link_libraries(${PROJECT} PRIVATE
pico_stdlib
pico_time
pico_unique_id
pico_bootrom
pico_bootsel_via_double_reset
pico_rand
hardware_adc
hardware_flash
hardware_i2c
hardware_pwm
hardware_spi
hardware_sync
hardware_timer
tinyusb_device
)
target_include_directories(${PROJECT} PUBLIC
src
src/headers
deps
)
target_sources(${PROJECT} PUBLIC
src/bus.c
src/button.c
src/common.c
src/config.c
src/ctrl.c
src/dhat.c
src/esp.c
src/glyph.c
src/gyro.c
src/hid.c
src/imu.c
src/led.c
src/logging.c
src/loop.c
src/nvm.c
src/power.c
src/profile.c
src/profiles/console_legacy.c
src/profiles/console.c
src/profiles/custom.c
src/profiles/desktop.c
src/profiles/flight.c
src/profiles/fps_fusion.c
src/profiles/fps_wasd.c
src/profiles/home.c
src/profiles/racing.c
src/profiles/rts.c
src/rotary.c
src/self_test.c
src/thanks.c
src/thumbstick.c
src/touch.c
src/tusb_config.c
src/uart.c
src/vector.c
src/webusb.c
src/wireless.c
src/xinput.c
)
if(DEVICE MATCHES "llama")
set(PORT PI_PICO)
set(MD5_ENABLED 1) # For after-flashing hash verification.
add_subdirectory("deps/esp-serial-flasher" ${CMAKE_BINARY_DIR}/flasher)
target_link_libraries(${PROJECT} PRIVATE flasher)
target_sources(${PROJECT} PUBLIC deps/esp-serial-flasher/examples/common/example_common.c)
endif()
pico_enable_stdio_uart(${PROJECT} 1)
pico_add_extra_outputs(${PROJECT})