-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
163 lines (137 loc) · 4.28 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
SET(PROJECT_NAME IBSE)
PROJECT(${PROJECT_NAME})
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
#set(CMAKE_VERBOSE_MAKEFILE ON)
#set(BUILD_TYPE Release)
set(BUILD_TYPE RelWithDebInfo)
set(EXECUTABLE_OUTPUT_PATH bin)
set(LIBRARY_OUTPUT_PATH lib)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# required libraries
#find_package(Eigen3 REQUIRED)
set(EIGEN3_INCLUDE_DIR /usr/include/eigen3/)
find_package(OpenCV 2.0 QUIET)
if(NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV > 2.0 not found.")
endif()
set(CMAKE_CXX_FLAGS
"-O3 -g -std=c++11 -march=native -Wall -Werror"
)
# Sources files
set(ibse_SOURCE_FILES
${PROJECT_SOURCE_DIR}/src/ibse.cpp
${PROJECT_SOURCE_DIR}/src/ibse_impl.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp
)
include_directories(
${PROJECT_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
)
# compile main library.
add_library(ibse SHARED
${ibse_SOURCE_FILES}
)
target_link_libraries(ibse
${OpenCV_LIBS}
)
# Enable and compile tests
#
enable_testing()
set(TEST_LIBS nlopt ${OpenCV_LIBS})
# Internal component tests
add_executable(
linear_interpolation_test
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp
${PROJECT_SOURCE_DIR}/src/linear_interpolation_test.cpp )
target_link_libraries(linear_interpolation_test
${TEST_LIBS}
)
add_test(linear_interpolation_test bin/linear_interpolation_test)
add_executable(
ltsi_test
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp
${PROJECT_SOURCE_DIR}/src/ltsi_test.cpp )
target_link_libraries(ltsi_test
${TEST_LIBS}
)
add_test(ltsi_test bin/ltsi_test)
add_executable(golden_section_search_test
${PROJECT_SOURCE_DIR}/src/golden_section_search_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(golden_section_search_test
${TEST_LIBS}
)
add_test(golden_search_test bin/golden_section_search_test)
add_executable(moving_average_test
${PROJECT_SOURCE_DIR}/src/moving_average_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(moving_average_test
${TEST_LIBS}
)
add_test(moving_average_test bin/moving_average_test)
add_executable(objective_function_test
${PROJECT_SOURCE_DIR}/src/objective_function_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(objective_function_test
${TEST_LIBS}
)
add_test(moving_average_test bin/moving_average_test)
add_executable(rotation_test
${PROJECT_SOURCE_DIR}/src/rotation_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(rotation_test
${TEST_LIBS}
)
add_test(rotation_test bin/rotation_test)
add_executable(kalman_test
${PROJECT_SOURCE_DIR}/src/kalman_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(kalman_test
${TEST_LIBS}
)
add_test(kalman_test bin/kalman_test)
add_executable(estimate_alignment_test
${PROJECT_SOURCE_DIR}/src/estimate_alignment_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(estimate_alignment_test
${TEST_LIBS}
)
add_test(estimate_alignment_test bin/estimate_alignment_test)
add_executable(align_camera_imu_test
${PROJECT_SOURCE_DIR}/src/align_camera_imu_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(align_camera_imu_test
${TEST_LIBS}
)
add_test(align_camera_imu_test bin/align_camera_imu_test)
add_executable(initialize_estimates_test
${PROJECT_SOURCE_DIR}/src/initialize_estimates_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(initialize_estimates_test
${TEST_LIBS}
)
add_test(initialize_estimates_test bin/initialize_estimates_test)
add_executable(estimate_scale_test
${PROJECT_SOURCE_DIR}/src/estimate_scale_test.cpp
${PROJECT_SOURCE_DIR}/src/ibse_testing.cpp
${PROJECT_SOURCE_DIR}/src/ibse_internal.cpp)
target_link_libraries(estimate_scale_test
${TEST_LIBS}
)
add_test(estimate_scale_test bin/estimate_scale_test)
# Full library tests
add_executable(ibse_test
${PROJECT_SOURCE_DIR}/src/ibse_test.cpp)
target_link_libraries(ibse_test
ibse
${TEST_LIBS}
)
add_test(ibse_test bin/ibse_test)