-
Notifications
You must be signed in to change notification settings - Fork 111
/
CMakeLists.txt
286 lines (247 loc) · 8.58 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Minimum cmake version is set to current version in Ubuntu 20.04
cmake_minimum_required(VERSION 3.16.3)
project(ssl-vision)
set(OpenGL_GL_PREFERENCE LEGACY)
set(USE_DC1394 TRUE CACHE BOOL "Compile with DC1394 driver (firewire cameras)")
set(USE_SPINNAKER FALSE CACHE BOOL "Compile with Spinnaker driver (FLIR cameras)")
set(USE_mvIMPACT FALSE CACHE BOOL "Compile with mvImpact driver (bluefox USB2 + USB3 cameras)")
set(USE_PYLON FALSE CACHE BOOL "Compile with pylon driver (Basler cameras)")
set(USE_FLYCAP FALSE CACHE BOOL "Compile with flycap driver (FLIR cameras, predecessor of Spinnaker)")
set(USE_V4L TRUE CACHE BOOL "Compile with Video4Linux support (generic webcams)")
set(USE_SPLITTER FALSE CACHE BOOL "Compile with Camera splitter support (virtual cameras with part of a full image)")
if(USE_DC1394 AND USE_mvIMPACT)
message(FATAL_ERROR "DC1394 and mvImpact are not compatible: mvImpact crashes when creating device manager")
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 11)
# Find third-party libraries
find_package(OpenGL REQUIRED)
find_package(Threads REQUIRED)
find_package(Protobuf REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
# Note: Bluefox SDK is not compatible with some components of OpenCV. Take care when enabling more.
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs videoio calib3d)
include(src/shared/CMakeLists.txt.inc)
if( USE_mvIMPACT )
find_package(mvIMPACT REQUIRED)
include_directories(${mvIMPACT_INCLUDE_DIR})
add_definitions(-D MVIMPACT3)
add_definitions(-D MVIMPACT2)
set (SHARED_SRCS ${SHARED_SRCS}
${shared_dir}/capture/capture_bluefox2.cpp
${shared_dir}/capture/capture_bluefox3.cpp
)
set (SHARED_HEADERS ${SHARED_HEADERS}
${shared_dir}/capture/capture_bluefox2.h
${shared_dir}/capture/capture_bluefox3.h
)
message(STATUS "mvIMPACT enabled")
else()
message(STATUS "mvIMPACT disabled")
endif()
if( USE_FLYCAP )
set(FLYCAP_HINTS "/usr/include/flycapture")
find_package(FLYCAP REQUIRED)
include_directories(${FLYCAP_INCLUDE_DIRS})
add_definitions(-D FLYCAP)
set (SHARED_SRCS ${SHARED_SRCS} ${shared_dir}/capture/capture_flycap.cpp)
set (SHARED_HEADERS ${SHARED_HEADERS} ${shared_dir}/capture/capture_flycap.h)
set (FLYCAP_LIBS flycapture)
message(STATUS "Flycap enabled")
else()
message(STATUS "Flycap disabled")
endif()
if(USE_DC1394)
pkg_check_modules(DC1394 REQUIRED libdc1394-2)
add_definitions(-D DC1394)
set (SHARED_SRCS ${SHARED_SRCS}
${shared_dir}/capture/capturedc1394v2.cpp
)
set (SHARED_HEADERS ${SHARED_HEADERS}
${shared_dir}/capture/capturedc1394v2.h
)
message(STATUS "DC1394 enabled")
else()
add_definitions(-D NO_DC1394_CONVERSIONS)
set(DC1394_LIBRARIES "")
message(STATUS "DC1394 disabled")
endif()
if( USE_PYLON )
find_package( PYLON REQUIRED )
include_directories(SYSTEM ${PYLON_INCLUDE_DIRS})
add_definitions(-DPYLON)
set (SHARED_SRCS ${SHARED_SRCS} ${shared_dir}/capture/capture_basler.cpp)
set (SHARED_HEADERS ${SHARED_HEADERS} ${shared_dir}/capture/capture_basler.h)
message(STATUS "Pylon enabled")
else()
message(STATUS "Pylon disabled")
endif()
if( USE_SPINNAKER )
find_package( SPINNAKER REQUIRED )
add_definitions( -DSPINNAKER )
include_directories( ${SPINNAKER_INCLUDE_DIRS} )
set (SHARED_SRCS ${SHARED_SRCS} ${shared_dir}/capture/capture_spinnaker.cpp)
set (SHARED_HEADERS ${SHARED_HEADERS} ${shared_dir}/capture/capture_spinnaker.h)
message(STATUS "SPINNAKER enabled")
else()
set( SPINNAKER_LIBS "" )
message(STATUS "SPINNAKER disabled")
endif()
if( USE_V4L )
add_definitions( -DV4L )
set (SHARED_SRCS ${SHARED_SRCS} ${shared_dir}/capture/capturev4l.cpp)
set (SHARED_HEADERS ${SHARED_HEADERS} ${shared_dir}/capture/capturev4l.h)
message(STATUS "Video 4 Linux enabled")
set(V4L_LIBS jpeg)
else()
message(STATUS "Video 4 Linux disabled")
set(V4L_LIBS)
endif()
if( USE_SPLITTER )
add_definitions( -DCAMERA_SPLITTER )
set (SHARED_SRCS ${SHARED_SRCS} ${shared_dir}/capture/capture_splitter.cpp)
set (SHARED_HEADERS ${SHARED_HEADERS} ${shared_dir}/capture/capture_splitter.h)
set (SRCS ${SRCS}
src/app/plugins/plugin_distribute.cpp
src/app/stacks/DistributorStack.cpp
)
message(STATUS "Camera splitter enabled")
else()
message(STATUS "Camera splitter disabled")
endif()
include_directories(${PROJECT_SOURCE_DIR}/src/app)
include_directories(${PROJECT_SOURCE_DIR}/src/app/gui)
include_directories(${PROJECT_SOURCE_DIR}/src/app/plugins)
include_directories(${PROJECT_SOURCE_DIR}/src/app/stacks)
set (SRCS ${SRCS}
src/app/capture_thread.cpp
src/app/framedata.cpp
src/app/main.cpp
src/app/gui/maskwidget.cpp
src/app/gui/automatedcolorcalibwidget.cpp
src/app/gui/camera_intrinsic_calib_widget.cpp
src/app/gui/cameracalibwidget.cpp
src/app/gui/colorpicker.cpp
src/app/gui/glLUTwidget.cpp
src/app/gui/glwidget.cpp
src/app/gui/lutwidget.cpp
src/app/gui/mainwindow.cpp
src/app/gui/realtimedisplaywidget.cpp
src/app/gui/renderoptions.cpp
src/app/gui/videowidget.cpp
src/app/gui/jog_dial.cpp
src/app/plugins/plugin_mask.cpp
src/app/plugins/plugin_cameracalib.cpp
src/app/plugins/plugin_camera_intrinsic_calib.cpp
src/app/plugins/plugin_colorcalib.cpp
src/app/plugins/plugin_colorthreshold.cpp
src/app/plugins/plugin_detect_balls.cpp
src/app/plugins/plugin_detect_robots.cpp
src/app/plugins/plugin_find_blobs.cpp
src/app/plugins/plugin_publishgeometry.cpp
src/app/plugins/plugin_legacypublishgeometry.cpp
src/app/plugins/plugin_runlength_encode.cpp
src/app/plugins/plugin_sslnetworkoutput.cpp
src/app/plugins/plugin_legacysslnetworkoutput.cpp
src/app/plugins/plugin_visualize.cpp
src/app/plugins/plugin_dvr.cpp
src/app/plugins/plugin_auto_color_calibration.cpp
src/app/plugins/visionplugin.cpp
src/app/stacks/multistack_robocup_ssl.cpp
src/app/stacks/multivisionstack.cpp
src/app/stacks/stack_robocup_ssl.cpp
src/app/stacks/visionstack.cpp
${OPTIONAL_SRCS}
)
qt5_wrap_cpp (MOC_SRCS
src/app/capture_thread.h
src/app/gui/maskwidget.h
src/app/gui/automatedcolorcalibwidget.h
src/app/gui/camera_intrinsic_calib_widget.h
src/app/gui/cameracalibwidget.h
src/app/gui/glLUTwidget.h
src/app/gui/glwidget.h
src/app/gui/lutwidget.h
src/app/gui/mainwindow.h
src/app/gui/videowidget.h
src/app/gui/jog_dial.h
src/shared/util/lut3d.h
src/shared/util/convex_hull_image_mask.h
src/app/plugins/plugin_dvr.h
src/app/plugins/plugin_publishgeometry.h
src/app/plugins/plugin_legacypublishgeometry.h
src/app/plugins/visionplugin.h
src/app/plugins/plugin_colorcalib.h
src/app/plugins/plugin_colorthreshold.h
src/app/plugins/plugin_auto_color_calibration.h
src/app/plugins/plugin_camera_intrinsic_calib.h
src/app/stacks/multistack_robocup_ssl.h
src/shared/util/camera_parameters.h
${OPTIONAL_HEADERS}
)
qt5_wrap_ui (UI_SRCS
src/app/gui/mainwindow.ui
src/app/gui/videowidget.ui
${OPTIONAL_UI_SRCS}
)
qt5_add_resources(RC_SRCS
src/app/gui/icons/icons_gui.qrc
${SHARED_RC}
)
## generate moc files for graphicalClient
qt5_wrap_cpp(GCLIENT_MOC_SRCS
src/graphicalClient/soccerview.h
)
## shared qt wrappings
qt5_wrap_cpp (SHARED_MOC_SRCS
${SHARED_HEADERS}
)
qt5_add_resources(SHARED_RC_SRCS
${SHARED_RC}
)
# enable warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations")
#flags to set in debug mode
set (CMAKE_CXX_FLAGS_DEBUG "-g -Wl,--no-as-needed")
#flags to set in release mode
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -march=native -Wl,--no-as-needed")
## build the common code
add_library(sslvision ${SHARED_MOC_SRCS} ${SHARED_RC_SRCS} ${CC_PROTO} ${SHARED_SRCS})
add_dependencies(sslvision GenerateProto)
set (libs
${QT_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
${PROTOBUF_LIBRARIES}
${DC1394_LIBRARIES}
${mvIMPACT_LIBS}
${PYLON_LIBRARIES}
${OpenCV_LIBS}
${FLYCAP_LIBS}
${SPINNAKER_LIBS}
${V4L_LIBS}
Eigen3::Eigen
)
target_link_libraries(sslvision ${libs} Qt5::Widgets)
set (libs ${libs} sslvision)
## build the main app
add_executable(vision ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS} ${SRCS})
target_link_libraries(vision ${libs} Qt5::Widgets Qt5::OpenGL)
## build non graphical client
add_executable(client src/client/main.cpp )
target_link_libraries(client ${libs} Qt5::Core)
## build graphical client
add_executable(graphicalClient ${GCLIENT_MOC_SRCS}
src/graphicalClient/main.cpp
src/graphicalClient/soccerview.cpp
src/graphicalClient/gltext.cpp
)
target_link_libraries(graphicalClient ${libs} Qt5::Widgets Qt5::OpenGL)