-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
105 lines (93 loc) · 2.86 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
cmake_minimum_required( VERSION 3.5.1 )
# Set project name.
project(solution-simple-vo)
# Set executable name.
set(exe_name solution-simple-vo)
# 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(Eigen3 3.3.4 REQUIRED)
find_package(Sophus 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})
target_sources(${exe_name} PRIVATE
lab_vo.h
lab_vo.cpp
pose_measurement.h
pose_measurement.cpp
calibrated_camera.h
calibrated_opencv_camera.h
calibrated_opencv_camera.cpp
correspondences.h
correspondences.cpp
feature_utils.h
feature_utils.cpp
frame.h
frame.cpp
intrinsic_calibration.h
intrinsic_calibration.cpp
main.cpp
matcher.h
matcher.cpp
map.h
map.cpp
moba_pose_estimator.h
moba_pose_estimator.cpp
pose_estimator.h
point_measurement.h
point_measurement.cpp
pnp_pose_estimator.h
pnp_pose_estimator.cpp
two_view_relative_pose_estimator.h
two_view_relative_pose_estimator.cpp
relative_pose_estimate.h
relative_pose_estimate.cpp
scene_3d.h
scene_3d.cpp
points_estimator.h
dlt_points_estimator.h
dlt_points_estimator.cpp
soba_points_estimator.h
soba_points_estimator.cpp)
# Specify libraries that will be linked with the executable target.
target_link_libraries(${exe_name}
${OpenCV_LIBS}
Eigen3::Eigen
Sophus::Sophus
tek5030::tek5030
)
if(TARGET tek5030::rs2) # if(tek5030_rs2_FOUND) does also work
message(STATUS "* Support for Intel® RealSense™ ENABLED")
target_compile_definitions(${exe_name} PUBLIC TEK5030_REALSENSE)
target_link_libraries(${exe_name} tek5030::rs2)
target_sources(${exe_name} PRIVATE
calibrated_realsense_camera.h
calibrated_realsense_camera.cpp
)
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>"
)