-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (61 loc) · 2.02 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
cmake_minimum_required(VERSION 3.5.1)
# Set project name.
project(solution-stereo)
# Set executable name.
set(exe_name solution-stereo)
# Make cmake first look for "Find<package>.cmake" functions generated by conan.
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
# Export commands for vscode.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Find required libraries.
find_package(OpenCV 4 REQUIRED)
find_package(tek5030 CONFIG REQUIRED OPTIONAL_COMPONENTS rs2)
# We use the "OpenCV_LIBS" variable for backward compatibility with the old lab setup.
if (NOT OpenCV_LIBS)
set(OpenCV_LIBS "opencv::opencv")
endif()
# Add an executable target to the project with the specified source files.
add_executable(${exe_name}
cv_stereo_matcher_wrap.h
lab_stereo.h
sparse_stereo_matcher.h
stereo_calibration.h
viewer_3d.h
visualization.h
#
lab_stereo.cpp
main.cpp
sparse_stereo_matcher.cpp
stereo_calibration.cpp
viewer_3d.cpp
visualization.cpp
cv_stereo_matcher_wrap.cpp
)
#
# Specify libraries that will be linked with the executable target.
target_link_libraries(${exe_name}
${OpenCV_LIBS}
tek5030::tek5030
)
if(TARGET tek5030::rs2) # if(tek5030_rs2_FOUND) does also work
message(STATUS "* Support for Intel® RealSense™ ENABLED")
target_link_libraries(${exe_name} tek5030::rs2)
else()
message(STATUS "* Support for Intel® RealSense™ DISABLED because component tek5030::rs2 was not found")
endif()
# Set properties for the executable target.
set_target_properties(${exe_name} PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_STANDARD 17
)
# Define two groups of supported compilers.
set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
# Set compiler specific flags and definitions.
target_compile_options(${exe_name} PRIVATE
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wpedantic;-Wshadow;-Wformat=2>>"
"$<${msvc_cxx}:$<BUILD_INTERFACE:-W4>>"
)
target_compile_definitions(${exe_name} PUBLIC
"$<${msvc_cxx}:-D_USE_MATH_DEFINES>"
)