-
Notifications
You must be signed in to change notification settings - Fork 51
/
CMakeLists.tpl
220 lines (201 loc) · 4.89 KB
/
CMakeLists.tpl
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
cmake_minimum_required(VERSION 3.13)
%compile_options%
include(pico_sdk_import.cmake)
if(ADD_WIFI OR ADD_ETHERNET)
include(networking/CMakeLists.txt)
include(webui/CMakeLists.txt)
if(ADD_mDNS OR ADD_MQTT)
set(LWIP_DIR ${PICO_SDK_PATH}/lib/lwip)
include(${LWIP_DIR}/src/Filelists.cmake)
endif()
endif()
include(grbl/CMakeLists.txt)
include(fatfs/CMakeLists.txt)
include(trinamic/CMakeLists.txt)
include(spindle/CMakeLists.txt)
include(keypad/CMakeLists.txt)
include(embroidery/CMakeLists.txt)
include(laser/CMakeLists.txt)
include(plugins/CMakeLists.txt)
%include_libraries%
project(grblHAL)
pico_sdk_init()
if(AddMyPlugin)
add_executable(grblHAL
main.c
driver.c
serial.c
usb_serial.c
stdio_usb_descriptors.c
flash.c
i2c.c
spi.c
PCA9654E.c
ioports.c
ioports_analog.c
tmc_uart.c
my_plugin.c
boards/pico_cnc.c
boards/btt_skr_pico_10.c
eeprom/eeprom_24AAxxx.c
eeprom/eeprom_24LC16B.c
keypad/keypad.c
sdcard/sdcard.c
sdcard/ymodem.c
sdcard/fs_fatfs.c
sdcard/fs_littlefs.c
sdcard/macros.c
bluetooth/hc_05.c
motors/trinamic.c
littlefs/lfs.c
littlefs/lfs_util.c
littlefs_hal.c
fans/fans.c
)
else()
add_executable(grblHAL
main.c
driver.c
serial.c
usb_serial.c
stdio_usb_descriptors.c
flash.c
i2c.c
spi.c
PCA9654E.c
ioports.c
ioports_analog.c
tmc_uart.c
boards/pico_cnc.c
boards/btt_skr_pico_10.c
eeprom/eeprom_24AAxxx.c
eeprom/eeprom_24LC16B.c
keypad/keypad.c
sdcard/sdcard.c
sdcard/ymodem.c
sdcard/fs_fatfs.c
sdcard/fs_littlefs.c
sdcard/macros.c
bluetooth/hc_05.c
motors/trinamic.c
littlefs/lfs.c
littlefs/lfs_util.c
littlefs_hal.c
fans/fans.c
)
endif()
pico_generate_pio_header(grblHAL ${CMAKE_CURRENT_LIST_DIR}/driverPIO.pio)
target_compile_definitions(grblHAL PUBLIC RP2040)
target_compile_definitions(grblHAL PUBLIC NEW_FATFS)
target_compile_definitions(grblHAL PUBLIC LITTLEFS_ENABLE=1)
%compile_definitions%
if(ADD_WIFI)
target_compile_definitions(grblHAL PUBLIC WIFI_ENABLE=1)
target_compile_definitions(grblHAL PUBLIC NDEBUG)
target_sources(grblHAL PRIVATE
wifi.c
dhcpserver.c
)
target_link_libraries(grblHAL PRIVATE
pico_cyw43_arch_lwip_poll
)
endif()
if(ADD_ETHERNET)
target_compile_definitions(grblHAL PUBLIC ETHERNET_ENABLE=1)
target_compile_definitions(grblHAL PUBLIC CYW43_LWIP=0)
target_compile_definitions(grblHAL PUBLIC LWIP_NOASSERT)
include(networking/wiznet/CMakeLists.txt)
target_sources(grblHAL PRIVATE
w5x00_ll_driver.c
)
target_link_libraries(grblHAL PRIVATE
wiznet
pico_lwip
pico_lwip_nosys
)
endif()
if(ADD_WIFI OR ADD_ETHERNET)
target_compile_definitions(grblHAL PUBLIC WEBUI_AUTO_REPORT_INTERVAL=0)
if(ADD_mDNS)
target_compile_definitions(grblHAL PUBLIC LWIP_IGMP=1)
target_compile_definitions(grblHAL PUBLIC LWIP_NUM_NETIF_CLIENT_DATA=1)
target_compile_definitions(grblHAL PUBLIC LWIP_MDNS_RESPONDER=1)
target_compile_definitions(grblHAL PUBLIC MDNS_MAX_SERVICES=8)
target_compile_definitions(grblHAL PUBLIC MDNS_ENABLE=1)
target_sources(grblHAL PRIVATE
${lwipmdns_SRCS}
)
endif()
if(ADD_MQTT)
target_compile_definitions(grblHAL PUBLIC MQTT_ENABLE=1)
target_sources(grblHAL PRIVATE
${lwipmqtt_SRCS}
)
endif()
target_link_libraries(grblHAL PRIVATE
networking
webui
)
endif()
if(ADD_BLUETOOTH)
target_compile_definitions(grblHAL PUBLIC BLUETOOTH_ENABLE=1)
target_compile_definitions(grblHAL PUBLIC NDEBUG)
target_sources(grblHAL PRIVATE
bluetooth.c
)
target_include_directories(grblHAL PRIVATE ${PICO_SDK_PATH}/lib/btstack/src)
target_link_libraries(grblHAL PRIVATE
pico_btstack_classic
pico_btstack_ble
pico_btstack_cyw43
)
if(NOT ADD_WIFI)
target_compile_definitions(grblHAL PUBLIC CYW43_LWIP=0)
target_link_libraries(grblHAL PRIVATE
pico_cyw43_arch_poll
)
endif()
endif()
if(AddMyPlugin)
target_sources(grblHAL PRIVATE
my_plugin.c
)
endif()
target_include_directories(grblHAL PRIVATE ${CMAKE_CURRENT_LIST_DIR})
if(PICO_PLATFORM STREQUAL "rp2040")
target_link_libraries(grblHAL PRIVATE
hardware_rtc
)
endif()
target_link_libraries(grblHAL PRIVATE
grbl
fatfs
trinamic
spindle
keypad
laser
misc_plugins
embroidery
tinyusb_device_unmarked
pico_stdlib
pico_unique_id
hardware_dma
hardware_uart
hardware_pio
hardware_i2c
hardware_spi
hardware_gpio
hardware_pwm
hardware_clocks
hardware_flash
%link_libraries%
)
pico_add_extra_outputs(grblHAL)
unset(PICO_BOARD CACHE)
unset(PICO_PLATFORM CACHE)
unset(ADD_WIFI CACHE)
unset(ADD_ETHERNET CACHE)
unset(ADD_BLUETOOTH CACHE)
unset(ADD_HPGL CACHE)
unset(ADD_mDNS CACHE)
unset(AddMyPlugin CACHE)