forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
248 lines (219 loc) · 10.1 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
# ----------------------------------------------------------------------------
# минимальная версия CMake, способная переварить этот файл
# ----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
project(MultitargetTracker)
unset(CMAKE_CXX_FLAGS CACHE)
find_package(OpenMP)
if (OPENMP_FOUND)
list(APPEND CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
list(APPEND CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic-errors --std=gnu++14" CACHE STRING COMPILE_FLAGS FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -march=native -mtune=native --fast-math -ffast-math -funroll-loops -Wall -DNDEBUG -DBOOST_DISABLE_ASSERTS" CACHE STRING COMPILE_FLAGS FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -march=native -mtune=native -Wall -DDEBUG" CACHE STRING COMPILE_FLAGS FORCE)
elseif (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W4 -DGTL_STATIC" CACHE STRING COMPILE_FLAGS FORCE)
endif()
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
# ----------------------------------------------------------------------------
# Предполагаем, что FindOpenCV.cmake расположен по адресу CMAKE_MODULE_PATH.
# ----------------------------------------------------------------------------
FIND_PACKAGE(OpenCV)
# ----------------------------------------------------------------------------
# ищем все .cpp и .h файлы и добавляем их в наш проект
# ----------------------------------------------------------------------------
set(folder_source
main.cpp
Detector/BaseDetector.cpp
Detector/MotionDetector.cpp
Detector/BackgroundSubtract.cpp
Detector/vibe_src/vibe.cpp
Detector/Subsense/BackgroundSubtractorLBSP.cpp
Detector/Subsense/BackgroundSubtractorLOBSTER.cpp
Detector/Subsense/BackgroundSubtractorSuBSENSE.cpp
Detector/Subsense/LBSP.cpp
Detector/FaceDetector.cpp
Detector/PedestrianDetector.cpp
Detector/pedestrians/c4-pedestrian-detector.cpp
Detector/SSDMobileNetDetector.cpp
Detector/YoloDetector.cpp
Tracker/Ctracker.cpp
Tracker/track.cpp
Tracker/HungarianAlg/HungarianAlg.cpp
Tracker/LocalTracker.cpp
Tracker/Kalman.cpp
)
set(folder_headers
MouseExample.h
VideoExample.h
nms.h
defines.h
Detector/BaseDetector.h
Detector/MotionDetector.h
Detector/BackgroundSubtract.h
Detector/vibe_src/vibe.hpp
Detector/Subsense/BackgroundSubtractorLBSP.h
Detector/Subsense/BackgroundSubtractorLOBSTER.h
Detector/Subsense/BackgroundSubtractorSuBSENSE.h
Detector/Subsense/DistanceUtils.h
Detector/Subsense/LBSP.h
Detector/Subsense/RandUtils.h
Detector/FaceDetector.h
Detector/PedestrianDetector.h
Detector/pedestrians/c4-pedestrian-detector.h
Detector/SSDMobileNetDetector.h
Detector/YoloDetector.h
Tracker/Ctracker.h
Tracker/track.h
Tracker/HungarianAlg/HungarianAlg.h
Tracker/LocalTracker.h
Tracker/Kalman.h
)
set(graph_source
Tracker/graph/tokenise.cpp
# Tracker/graph/script.cpp
# Tracker/graph/rings.cpp
Tracker/graph/mytree.cpp
Tracker/graph/mygraph.cpp
Tracker/graph/mwbmatching.cpp
Tracker/graph/mincut.cpp
Tracker/graph/gport.cpp
# Tracker/graph/gml2nestedsql.cpp
# Tracker/graph/gml2dot.cpp
# Tracker/graph/components.cpp
Tracker/graph/fheap.c
)
set(graph_header
Tracker/graph/tokenise.h
Tracker/graph/mytree.h
Tracker/graph/mygraph.h
Tracker/graph/mwbmatching.h
Tracker/graph/mincut.h
Tracker/graph/gport.h
Tracker/graph/gdefs.h
Tracker/graph/fheap.h
)
set(gtl_source
Tracker/graph/GTL/src/bellman_ford.cpp
Tracker/graph/GTL/src/bfs.cpp
Tracker/graph/GTL/src/biconnectivity.cpp
Tracker/graph/GTL/src/bid_dijkstra.cpp
Tracker/graph/GTL/src/components.cpp
Tracker/graph/GTL/src/debug.cpp
Tracker/graph/GTL/src/dfs.cpp
Tracker/graph/GTL/src/dijkstra.cpp
Tracker/graph/GTL/src/edge.cpp
Tracker/graph/GTL/src/embedding.cpp
Tracker/graph/GTL/src/fm_partition.cpp
Tracker/graph/GTL/src/gml_parser.cpp
Tracker/graph/GTL/src/gml_scanner.cpp
Tracker/graph/GTL/src/graph.cpp
Tracker/graph/GTL/src/maxflow_ff.cpp
Tracker/graph/GTL/src/maxflow_pp.cpp
Tracker/graph/GTL/src/maxflow_sap.cpp
Tracker/graph/GTL/src/min_tree.cpp
Tracker/graph/GTL/src/node.cpp
Tracker/graph/GTL/src/planarity.cpp
Tracker/graph/GTL/src/pq_node.cpp
Tracker/graph/GTL/src/pq_tree.cpp
Tracker/graph/GTL/src/ratio_cut_partition.cpp
Tracker/graph/GTL/src/st_number.cpp
Tracker/graph/GTL/src/topsort.cpp
)
set(gtl_header
Tracker/graph/GTL/include/GTL/algorithm.h
Tracker/graph/GTL/include/GTL/bellman_ford.h
Tracker/graph/GTL/include/GTL/bfs.h
Tracker/graph/GTL/include/GTL/biconnectivity.h
Tracker/graph/GTL/include/GTL/bid_dijkstra.h
Tracker/graph/GTL/include/GTL/bin_heap.h
Tracker/graph/GTL/include/GTL/components.h
Tracker/graph/GTL/include/GTL/debug.h
Tracker/graph/GTL/include/GTL/dfs.h
Tracker/graph/GTL/include/GTL/dijkstra.h
Tracker/graph/GTL/include/GTL/edge.h
Tracker/graph/GTL/include/GTL/edge_data.h
Tracker/graph/GTL/include/GTL/edge_map.h
Tracker/graph/GTL/include/GTL/embedding.h
Tracker/graph/GTL/include/GTL/fm_partition.h
Tracker/graph/GTL/include/GTL/gml_parser.h
Tracker/graph/GTL/include/GTL/gml_scanner.h
Tracker/graph/GTL/include/GTL/graph.h
Tracker/graph/GTL/include/GTL/maxflow_ff.h
Tracker/graph/GTL/include/GTL/maxflow_pp.h
Tracker/graph/GTL/include/GTL/maxflow_sap.h
Tracker/graph/GTL/include/GTL/min_tree.h
Tracker/graph/GTL/include/GTL/ne_map.h
Tracker/graph/GTL/include/GTL/node.h
Tracker/graph/GTL/include/GTL/node_data.h
Tracker/graph/GTL/include/GTL/node_map.h
Tracker/graph/GTL/include/GTL/planarity.h
Tracker/graph/GTL/include/GTL/pq_node.h
Tracker/graph/GTL/include/GTL/pq_tree.h
Tracker/graph/GTL/include/GTL/ratio_cut_partition.h
Tracker/graph/GTL/include/GTL/st_number.h
Tracker/graph/GTL/include/GTL/symlist.h
Tracker/graph/GTL/include/GTL/topsort.h
Tracker/graph/GTL/include/GTL/version.h
Tracker/graph/GTL/include/GTL/GTL.h
)
SOURCE_GROUP("Source Files" FILES ${folder_source})
SOURCE_GROUP("Header Files" FILES ${folder_headers})
SOURCE_GROUP("graph" FILES ${graph_source} ${graph_header})
SOURCE_GROUP("GTL" FILES ${gtl_source} ${gtl_header})
include(CheckIncludeFileCXX)
check_include_file_cxx(opencv2/bgsegm.hpp HAVE_OPENCV_CONTRIB)
if(HAVE_OPENCV_CONTRIB)
add_definitions(-DHAVE_OPENCV_CONTRIB)
option(USE_OCV_BGFG "Should use the bgfg algorithms from opencv_contrib?" ON)
option(USE_OCV_KCF "Should use the KCF tracker from opencv_contrib for collisions resolving?" ON)
option(USE_OCV_UKF "Should use the Unscented Kalman Filterr from opencv_contrib?" ON)
else(HAVE_OPENCV_CONTRIB)
option(USE_OCV_BGFG "Should use the bgfg algorithms from opencv_contrib?" OFF)
option(USE_OCV_KCF "Should use the KCF tracker from opencv_contrib for collisions resolving?" OFF)
option(USE_OCV_UKF "Should use the Unscented Kalman Filterr from opencv_contrib?" OFF)
endif(HAVE_OPENCV_CONTRIB)
if(USE_OCV_UKF)
add_definitions(-DUSE_OCV_UKF)
endif(USE_OCV_UKF)
if(USE_OCV_KCF)
add_definitions(-DUSE_OCV_KCF)
endif(USE_OCV_KCF)
if(USE_OCV_BGFG)
add_definitions(-DUSE_OCV_BGFG)
endif(USE_OCV_BGFG)
# ----------------------------------------------------------------------------
# создаем проект
# ----------------------------------------------------------------------------
ADD_EXECUTABLE(MultitargetTracker ${folder_source} ${folder_headers} ${graph_source} ${graph_header} ${gtl_source} ${gtl_header})
# ----------------------------------------------------------------------------
# добавляем include директории
# ----------------------------------------------------------------------------
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/Detector
${PROJECT_SOURCE_DIR}/Detector/vibe_src
${PROJECT_SOURCE_DIR}/Detector/Subsense
${PROJECT_SOURCE_DIR}/Tracker
${PROJECT_SOURCE_DIR}/Tracker/HungarianAlg
${PROJECT_SOURCE_DIR}/Tracker/graph
${PROJECT_SOURCE_DIR}/Tracker/graph/GTL/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
# ----------------------------------------------------------------------------
# и Lib-ы opencv
# ----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCXX)
set(LIBS
${OpenCV_LIBS}
# iconv
)
else(CMAKE_COMPILER_IS_GNUCXX)
set(LIBS
${OpenCV_LIBS}
)
endif()
TARGET_LINK_LIBRARIES(MultitargetTracker ${LIBS})