forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
268 lines (223 loc) · 8.73 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
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2019 Intel Corporation. All Rights Reserved.
# minimum required cmake version: 3.1.0
cmake_minimum_required(VERSION 3.1.0)
project(RealsenseToolsRealSenseViewer)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
include_directories(${CMAKE_BINARY_DIR})
if(${BUILD_EASYLOGGINGPP})
set( ELPP_DIR ../../third-party/easyloggingpp/src )
include_directories( ${ELPP_DIR} )
set( ELPP_FILES
${ELPP_DIR}/easylogging++.cc
${ELPP_DIR}/easylogging++.h
)
endif()
include(../../common/CMakeLists.txt)
if(BUILD_GRAPHICAL_EXAMPLES)
set(RS_VIEWER_CPP
${COMMON_SRC}
realsense-viewer.cpp
../../third-party/imgui/imgui.cpp
../../third-party/imgui/imgui_draw.cpp
../../third-party/imgui/imgui_impl_glfw.cpp
../../third-party/imgui/imgui-fonts-karla.hpp
../../third-party/imgui/imgui-fonts-fontawesome.hpp
../../common/realsense-ui-advanced-mode.h
../../common/rendering.h
../../common/model-views.h
../../common/model-views.cpp
../../common/ux-window.h
../../common/ux-window.cpp
../../common/ux-alignment.cpp
../../common/ux-alignment.h
../../common/processing-block-model.h
../../common/post-processing-block-model.h
../../common/post-processing-filter.h
../../common/post-processing-worker-filter.h
../../common/post-processing-filters-list.h
../../common/objects-in-frame.h
../../third-party/glad/glad.c
../../third-party/tinyfiledialogs/tinyfiledialogs.c
../../third-party/tinyfiledialogs/tinyfiledialogs.h
../../common/opengl3.cpp
../../common/opengl3.h
../../common/rs-config.h
../../common/rs-config.cpp
../../common/os.h
../../common/os.cpp
)
SET(DELAYED
realsense2d.dll
realsense2-gld.dll
realsense2.dll
realsense2-gl.dll
)
if(DEFINED OpenCV_DIR AND IS_DIRECTORY ${OpenCV_DIR})
find_package(OpenCV REQUIRED)
get_property(deps VARIABLE PROPERTY DEPENDENCIES)
set(DEPENDENCIES ${deps} ${OpenCV_LIBS})
include_directories( ../../wrappers/opencv )
list(APPEND DELAYED
opencv_highgui341.dll
opencv_core341.dll
opencv_imgproc341.dll
opencv_dnn341.dll
opencv_highgui341d.dll
opencv_core341d.dll
opencv_imgproc341d.dll
opencv_dnn341d.dll
)
endif()
include(../../wrappers/openvino/check_vino_version.cmake)
if(DEFINED INTEL_OPENVINO_DIR AND IS_DIRECTORY ${INTEL_OPENVINO_DIR})
message( STATUS "Enabling OpenVINO face-detection for realsense-viewer ..." )
set(IE_ROOT_DIR "${INTEL_OPENVINO_DIR}/inference_engine")
include(${INTEL_OPENVINO_DIR}/inference_engine/share/InferenceEngineConfig.cmake)
get_property(deps VARIABLE PROPERTY DEPENDENCIES)
check_vino_version()
if(OPENVINO2019)
set(DEPENDENCIES ${deps} ${InferenceEngine_LIBRARIES} ie_cpu_extension)
elseif(OPENVINO_NGRAPH)
include(${INTEL_OPENVINO_DIR}/deployment_tools/ngraph/cmake/ngraphConfig.cmake)
set(DEPENDENCIES ${deps} ${InferenceEngine_LIBRARIES} ${NGRAPH_LIBRARIES})
else()
set(DEPENDENCIES ${deps} ${InferenceEngine_LIBRARIES})
endif()
include_directories( ../../wrappers/openvino )
include_directories( ../../wrappers/opencv )
include_directories( ${InferenceEngine_INCLUDE_DIRS} )
if(OPENVINO2019)
# We need additional access to ext_list.hpp, for CPU extension support:
include_directories( "${IE_ROOT_DIR}/src/extension" )
elseif(OPENVINO_NGRAPH)
include_directories( "${INTEL_OPENVINO_DIR}/deployment_tools/ngraph/include" )
endif()
set(OPENVINO_FILES
../../wrappers/openvino/rs-vino/base-detection.cpp
../../wrappers/openvino/rs-vino/base-detection.h
../../wrappers/openvino/rs-vino/object-detection.cpp
../../wrappers/openvino/rs-vino/object-detection.h
../../wrappers/openvino/rs-vino/age-gender-detection.cpp
../../wrappers/openvino/rs-vino/age-gender-detection.h
../../wrappers/openvino/rs-vino/detected-object.cpp
../../wrappers/openvino/rs-vino/detected-object.h
../../wrappers/openvino/rs-vino/openvino-helpers.h
)
if(OPENVINO2019)
set(OPENVINO_FILES ${OPENVINO_FILES} "${IE_ROOT_DIR}/src/extension/ext_list.hpp")
endif()
set(RS_VIEWER_CPP
${RS_VIEWER_CPP}
openvino-face-detection.cpp
${OPENVINO_FILES}
)
include(../../wrappers/openvino/dl_vino_model.cmake)
# Download model files -- these will go into build/tools/realsense-viewer, which is also
# where the sample is run from in Visual Studio
if(OPENVINO2019)
dl_vino_model( "README.txt" "789e144d6cafa379c8437d2a6860829b6d935a8d" )
dl_vino_model( "face-detection-adas-0001.bin" "1625f05ada1d8e78e36856def7124f78cd0a6c2a" )
dl_vino_model( "face-detection-adas-0001.xml" "11c36f6e4488b2f5437ccff9f330d02545087ab3" )
dl_vino_model( "age-gender-recognition-retail-0013.bin" "206f6e97e53cd600fcac7d31e1c56accbbe461b9" )
dl_vino_model( "age-gender-recognition-retail-0013.xml" "2654d7f1638d575b8d1886f8128deae2ea79ee55" )
else()
# Newer model files with IRv10, 2020.1 and later
dl_vino_model( "README.txt" "789e144d6cafa379c8437d2a6860829b6d935a8d" )
dl_vino_model( "face-detection-adas-0001.bin" "065e9015297c7adbc650ebfc17176477cd0a4279" )
dl_vino_model( "face-detection-adas-0001.xml" "331be642a248213f586ec1d1b71c223435a437e3" )
dl_vino_model( "age-gender-recognition-retail-0013.bin" "206f6e97e53cd600fcac7d31e1c56accbbe461b9" )
dl_vino_model( "age-gender-recognition-retail-0013.xml" "36bde5d4d42d29515abe871f69097ffcf4ff6414" )
endif()
list(APPEND DELAYED
cpu_extension.dll
inference_engine.dll
libmmd.dll
mkl_tiny_tbb.dll
MKLDNNPlugin.dll
opencv_core412.dll
opencv_imgproc412.dll
svml_dispmd.dll
tbb.dll
tbbmalloc.dll
)
endif()
# config-ui
if(WIN32)
add_executable(realsense-viewer WIN32
${RS_VIEWER_CPP}
${ELPP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/res/resource.h
${CMAKE_CURRENT_SOURCE_DIR}/res/realsense-viewer.rc
../../common/windows-app-bootstrap.cpp
)
source_group("3rd Party" FILES
../../third-party/tinyfiledialogs/tinyfiledialogs.c
../../third-party/tinyfiledialogs/tinyfiledialogs.h
../../third-party/imgui/imgui.cpp
../../third-party/imgui/imgui_draw.cpp
../../third-party/imgui/imgui_impl_glfw.cpp
../../third-party/imgui/imgui-fonts-karla.hpp
../../third-party/imgui/imgui-fonts-fontawesome.hpp
)
source_group("Resources" FILES
${CMAKE_CURRENT_SOURCE_DIR}/res/resource.h
${CMAKE_CURRENT_SOURCE_DIR}/res/realsense-viewer.rc)
source_group("OpenVINO" FILES ${OPENVINO_FILES})
#list(TRANSFORM DELAYED PREPEND " /DELAYLOAD:") - Requires cmake v3.12
PREPEND(DELAYED " /DELAYLOAD:" ${DELAYED})
string(REPLACE ";" " " LD_FLAGS_STR "${DELAYED}")
set_target_properties(realsense-viewer PROPERTIES LINK_FLAGS "${LD_FLAGS_STR}")
else()
add_executable(realsense-viewer
${RS_VIEWER_CPP}
${ELPP_FILES}
)
endif()
if(OPENVINO2019)
target_compile_definitions(realsense-viewer PRIVATE OPENVINO2019)
endif()
if(OPENVINO_NGRAPH)
target_compile_definitions(realsense-viewer PRIVATE OPENVINO_NGRAPH)
endif()
source_group("EasyLogging++" FILES ${ELPP_FILES})
source_group("SW-Update" FILES ${SW_UPDATE_FILES})
include_directories(
../../common
../../third-party
../../third-party/tinyfiledialogs
${GLFW_SOURCE_DIR}/include
../../third-party/imgui
../../third-party/glad
)
set_property(TARGET realsense-viewer PROPERTY CXX_STANDARD 11)
set(RS_VIEWER_LIBS ${GTK3_LIBRARIES} Threads::Threads realsense2-gl)
if (CHECK_FOR_UPDATES)
message( STATUS "Check for updates capability added to realsense-viewer" )
add_dependencies(realsense-viewer libcurl)
set(RS_VIEWER_LIBS ${RS_VIEWER_LIBS} curl)
endif()
if (IMPORT_DEPTH_CAM_FW)
add_definitions(-DINTERNAL_FW)
target_link_libraries(realsense-viewer fw)
endif()
if(BUILD_NETWORK_DEVICE)
add_definitions(-DNETWORK_DEVICE)
set(RS_VIEWER_LIBS ${RS_VIEWER_LIBS} realsense2-net)
endif()
target_link_libraries(realsense-viewer ${DEPENDENCIES} ${RS_VIEWER_LIBS})
set_target_properties (realsense-viewer PROPERTIES
FOLDER Tools
)
target_include_directories(realsense-viewer PRIVATE ../../src)
install(
TARGETS realsense-viewer
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
#https://cmake.org/cmake/help/latest/command/install.html
install(DIRECTORY presets/
DESTINATION $ENV{HOME}/Documents/librealsense2/presets
FILES_MATCHING PATTERN "*.preset"
)
endif()