forked from grblHAL/RP2040
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
121 lines (109 loc) · 2.56 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
116
117
118
119
120
121
cmake_minimum_required(VERSION 3.13)
option(ADD_HPGL "Add HPGL plugin" OFF)
option(ADD_WIFI "Add WiFi networking" ON)
option(ADD_mDNS "Add mDNS service" OFF) # Set LWIP_DIR below to the root path of lwIP sources when ON!
if(ADD_WIFI)
set(PICO_BOARD pico_w)
endif()
include(pico_sdk_import.cmake)
if(ADD_WIFI)
include(networking/CMakeLists.txt)
include(webui/CMakeLists.txt)
if(ADD_mDNS)
set(LWIP_DIR /home/pi/pico/pico-sdk/lib/lwip) # LWIP_DIR
include(${LWIP_DIR}/src/Filelists.cmake)
endif()
endif()
include(grbl/CMakeLists.txt)
include(fatfs/CMakeLists.txt)
include(trinamic/CMakeLists.txt)
include(spindle/CMakeLists.txt)
if(ADD_HPGL)
include(hpgl/CMakeLists.txt)
endif()
project(grblHAL)
pico_sdk_init()
add_executable(grblHAL
main.c
driver.c
serial.c
usb_serial.c
stdio_usb_descriptors.c
flash.c
i2c.c
PCA9654E.c
pico_cnc.c
btt_skr_pico_10.c
ioports.c
tmc_uart.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
bluetooth/hc_05.c
motors/trinamic.c
littlefs/lfs.c
littlefs/lfs_util.c
littlefs_hal.c
)
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)
if(ADD_WIFI)
target_compile_definitions(grblHAL PUBLIC WIFI_ENABLE=1)
target_compile_definitions(grblHAL PUBLIC NDEBUG=1)
target_compile_definitions(grblHAL PUBLIC WEBUI_AUTO_REPORT_INTERVAL=0)
target_sources(grblHAL PRIVATE
wifi.c
dhcpserver.c
)
target_link_libraries(grblHAL PRIVATE
networking
webui
pico_cyw43_arch_lwip_poll
)
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()
endif()
if(ADD_HPGL)
target_sources(grblHAL PRIVATE
citoh_cx6000.c
)
target_link_libraries(grblHAL PRIVATE
hpgl
)
endif()
target_include_directories(grblHAL PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(grblHAL PRIVATE
grbl
fatfs
trinamic
spindle
tinyusb_device_unmarked
pico_stdlib
hardware_uart
hardware_pio
hardware_i2c
hardware_spi
hardware_gpio
hardware_pwm
hardware_rtc
hardware_clocks
hardware_flash
)
pico_add_extra_outputs(grblHAL)
unset(ADD_WIFI CACHE)
unset(ADD_HPGL CACHE)
unset(ADD_mDNS CACHE)