-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
241 lines (221 loc) · 10.5 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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
cmake_minimum_required(VERSION 3.27)
project(groundstation-2025)
set(CMAKE_CXX_STANDARD 17)
set(ABSL_PROPAGATE_CXX_STD ON)
# Add Protobuf as a subdirectory
set(BUILD_SHARED_LIBS OFF) # Use static libraries for Protobuf
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Disable Protobuf tests")
add_subdirectory(protobuf cmake-protobuf-build)
# Set Protobuf variables
set(Protobuf_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/cmake-protobuf-build/src/protobuf-build/include)
set(Protobuf_LIBRARIES protobuf::libprotobuf)
set(Protobuf_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>)
# Output Protobuf variables for debugging
message(STATUS "Protobuf_INCLUDE_DIRS: ${Protobuf_INCLUDE_DIRS}")
message(STATUS "Protobuf_LIBRARIES: ${Protobuf_LIBRARIES}")
message(STATUS "Protobuf_PROTOC_EXECUTABLE: ${Protobuf_PROTOC_EXECUTABLE}")
# Automatically find all .proto files in a directory
file(GLOB_RECURSE PROTO_FILES "${CMAKE_CURRENT_SOURCE_DIR}/telemetry/*.proto")
list(REMOVE_DUPLICATES PROTO_FILES) # Ensure no duplicates
# Print all .proto files line-by-line
message(STATUS "Proto Files Found:")
foreach(PROTO_FILE ${PROTO_FILES})
message(STATUS " - ${PROTO_FILE}")
endforeach()
# Create lists for the generated sources and headers
set(PROTO_SRCS
Frontend/Widgets/MapWidget/gpswidget.cpp
Frontend/Widgets/MapWidget/gpswidget.h
Frontend/Widgets/MapWidget/GpsWidget.ui
Frontend/Widgets/IndicatorWidget/GpsIndicator/PayloadGpsIndicator.cpp
Frontend/Widgets/IndicatorWidget/GpsIndicator/PayloadGpsIndicator.h
Frontend/Widgets/IndicatorWidget/GpsIndicator/RocketGpsIndicator.cpp
Frontend/Widgets/IndicatorWidget/GpsIndicator/RocketGpsIndicator.h)
set(PROTO_HDRS)
# Loop over all found .proto files
foreach(PROTO_FILE ${PROTO_FILES})
# Get the file name without the directory
get_filename_component(PROTO_NAME ${PROTO_FILE} NAME_WE)
# Get the relative directory of the .proto file from the source folder
file(RELATIVE_PATH REL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/telemetry ${PROTO_FILE})
get_filename_component(PROTO_DIR ${REL_PATH} DIRECTORY)
# Define the output directory for generated files
# Make sure the output directory structure doesn't get nested unnecessarily
set(PROTO_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/telemetry)
file(MAKE_DIRECTORY ${PROTO_OUTPUT_DIR}) # Create the directory if it doesn't exist
# Log to check if the directories are being resolved correctly
message(STATUS "Proto File: ${PROTO_FILE}")
message(STATUS "Output Directory: ${PROTO_OUTPUT_DIR}")
# Generate Protobuf files
add_custom_command(
OUTPUT ${PROTO_OUTPUT_DIR}/${PROTO_NAME}.pb.cc
${PROTO_OUTPUT_DIR}/${PROTO_NAME}.pb.h
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
--cpp_out=${PROTO_OUTPUT_DIR}
--proto_path=${CMAKE_CURRENT_SOURCE_DIR}/telemetry
${PROTO_FILE}
DEPENDS ${PROTO_FILE}
COMMENT "Generating Protobuf files for ${PROTO_FILE}"
)
# Append the generated source file to the list
list(APPEND PROTO_SRCS ${PROTO_OUTPUT_DIR}/${PROTO_NAME}.pb.cc)
endforeach()
# Include directories for generated headers
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PROTO_HDRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
SerialPort
WebSockets
3DCore
3DExtras
3DInput
3DRender
WebView
WebChannel
WebEngineWidgets
REQUIRED)
# Add the executable
add_executable(groundstation-2025
${PROTO_SRCS}
main.cpp
Resources/Resources.qrc
Backend/Backend.cpp
Backend/Backend.h
Backend/RadioModule.cpp
Backend/RadioModule.h
Utility/DataLogger.cpp
Utility/DataLogger.h
Constants.h
Utility/SerialPort.cpp
Utility/SerialPort.h
Utility/WebServer.cpp
Utility/WebServer.h
Utility/Utility.h
Utility/json_struct.h
Utility/json_struct.h
xbee/XBeeDevice.cpp
Frontend/Windows/RadioControlsWindow/RadioControlsWindow.cpp
Frontend/Windows/RadioControlsWindow/RadioControlsWindow.h
Frontend/Windows/RadioControlsWindow/RadioControlsWindow.ui
Frontend/Widgets/SerialPortList/SerialPortList.cpp
Frontend/Widgets/SerialPortList/SerialPortList.h
Utility/SerialPortManager.cpp
Utility/SerialPortManager.h
Frontend/Windows/TelemetryWindow/raw_telemetry.cpp
Frontend/Windows/TelemetryWindow/raw_telemetry.h
Frontend/Windows/TelemetryWindow/Raw_Telemetry.ui
Frontend/Widgets/TimeDateWidgets/datewidget.cpp
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/DateWidget.ui
Frontend/Widgets/TimeDateWidgets/groundtimewidget.cpp
Frontend/Widgets/TimeDateWidgets/groundtimewidget.h
Frontend/Widgets/TimeDateWidgets/groundtimewidget.h
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/groundtimewidget.h
Frontend/Widgets/TimeDateWidgets/rocketuptimewidget.cpp
Frontend/Widgets/TimeDateWidgets/rocketuptimewidget.h
Frontend/Widgets/TimeDateWidgets/rocketuptimewidget.h
Frontend/Widgets/TimeDateWidgets/payloaduptimewidget.h
Frontend/Widgets/TimeDateWidgets/payloaduptimewidget.cpp
Frontend/Widgets/TimeDateWidgets/groundflighttimewidget.h
Frontend/Widgets/TimeDateWidgets/groundflighttimewidget.cpp
Frontend/Widgets/TimeDateWidgets/datewidget.cpp
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/DateWidget.ui
Utility/DataSimulator/DataSimulator.cpp
Frontend/Widgets/TimeDateWidgets/datewidget.cpp
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/DateWidget.ui
Frontend/Widgets/TimeDateWidgets/groundtimewidget.cpp
Frontend/Widgets/TimeDateWidgets/groundtimewidget.h
Frontend/Widgets/TimeDateWidgets/groundtimewidget.h
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/datewidget.h
Frontend/Widgets/TimeDateWidgets/groundtimewidget.h
Frontend/Widgets/TimeDateWidgets/rocketuptimewidget.cpp
Frontend/Widgets/TimeDateWidgets/rocketuptimewidget.h
Frontend/Widgets/TimeDateWidgets/rocketuptimewidget.h
Frontend/Widgets/TimeDateWidgets/payloaduptimewidget.h
Frontend/Widgets/TimeDateWidgets/payloaduptimewidget.cpp
Frontend/Widgets/TimeDateWidgets/groundflighttimewidget.h
Frontend/Widgets/TimeDateWidgets/groundflighttimewidget.cpp
Frontend/Widgets/TimeDateWidgets/rocketflighttimewidget.h
Frontend/Widgets/TimeDateWidgets/rocketflighttimewidget.cpp
Frontend/Widgets/RadioPerformanceWidgets/droppedpacketswidget.cpp
Frontend/Widgets/RadioPerformanceWidgets/droppedpacketswidget.h
Frontend/Widgets/RadioPerformanceWidgets/rssiwidget.cpp
Frontend/Widgets/RadioPerformanceWidgets/rssiwidget.h
Frontend/Windows/RadioPerformanceWindow/radioperformancewindow.cpp
Frontend/Windows/RadioPerformanceWindow/radioperformancewindow.h
Frontend/Windows/RadioPerformanceWindow/radioperformancewindow.ui
Frontend/Windows/TelemetryWindow/raw_telemetry.cpp
Frontend/Windows/TelemetryWindow/raw_telemetry.h
Frontend/Windows/TelemetryWindow/Raw_Telemetry.ui
Frontend/Widgets/Viewer3D/Viewer3D.cpp
Frontend/Widgets/Viewer3D/Viewer3D.h
Frontend/Windows/MainWindow/mainwindow.cpp
Frontend/Windows/MainWindow/mainwindow.h
Frontend/Windows/MainWindow/mainwindow.ui
Frontend/Widgets/IndicatorWidget/IndicatorWidget/QLedLabel.cpp
Frontend/Widgets/IndicatorWidget/IndicatorWidget/QLedLabel.h
Frontend/Widgets/IndicatorWidget/IndicatorWidget/ledwidget.cpp
Frontend/Widgets/IndicatorWidget/IndicatorWidget/ledwidget.h
Frontend/Widgets/IndicatorWidget/IndicatorWidget/LedWidget.ui
Frontend/Widgets/IndicatorWidget/RocketIndicator/RocketConnectionIndicator.cpp
Frontend/Widgets/IndicatorWidget/RocketIndicator/RocketConnectionIndicator.h
Frontend/Widgets/IndicatorWidget/PayloadIndicator/PayloadConnectionIndicator.cpp
Frontend/Widgets/IndicatorWidget/PayloadIndicator/PayloadConnectionIndicator.h
Frontend/Windows/LogWindow/logwindow.cpp
Frontend/Windows/LogWindow/logwindow.h
Frontend/Windows/LogWindow/logwindow.ui
Utility/TelemetryHandler.cpp
Utility/TelemetryHandler.h
Frontend/Widgets/DataSimulationButton/DataSimulationButton.cpp
Frontend/Widgets/DataSimulationButton/DataSimulationButton.h
Utility/UnitConversions.h
Frontend/Widgets/RadioPerformanceWidgets/ThroughputDisplayWidget.cpp
Frontend/Widgets/RadioPerformanceWidgets/ThroughputDisplayWidget.h
Frontend/Widgets/MaxValueWidget/maxvaluewidget.cpp
Frontend/Widgets/MaxValueWidget/maxvaluewidget.h
Frontend/Widgets/MaxValueWidget/MaxValueWidget.ui
Frontend/Widgets/StateDisplayWidget/statedisplaywidget.cpp
Frontend/Widgets/StateDisplayWidget/statedisplaywidget.h
Frontend/Widgets/StateDisplayWidget/StateDisplayWidget.ui
Frontend/Widgets/TimelineWidget/timelinewidget.cpp
Frontend/Widgets/TimelineWidget/timelinewidget.h
Frontend/Widgets/TimelineWidget/TimelineWidget.ui
Frontend/Widgets/TimelineWidget/statesummarywidget.cpp
Frontend/Widgets/TimelineWidget/statesummarywidget.h
Frontend/Widgets/TimelineWidget/StateSummaryWidget.ui
Frontend/Widgets/MapWidget/mapwidget.cpp
Frontend/Widgets/MapWidget/mapwidget.h
Frontend/Widgets/MapWidget/MapWidget.ui
Frontend/Widgets/MapWidget/JSInterface.cpp
Frontend/Widgets/MapWidget/JSInterface.h
)
# Link Protobuf and Qt6 libraries
target_link_libraries(groundstation-2025
Qt6::Core
Qt6::Gui
Qt6::Widgets
Qt6::SerialPort
Qt6::WebSockets
Qt6::3DCore
Qt6::3DExtras
Qt6::3DInput
Qt6::3DRender
Qt6::WebEngineWidgets
Qt6::WebView
Qt6::WebChannel
${Protobuf_LIBRARIES}
)
# Include all generated files in the target
target_sources(groundstation-2025 PRIVATE ${PROTO_SRCS})