-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
141 lines (117 loc) · 4.38 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
cmake_minimum_required(VERSION 2.8.8)
# Project name
project(imucalib)
# Include our cmake files
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)
# Find catkin (the ROS build system)
find_package(catkin QUIET COMPONENTS roscpp)
# Include libraries
find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time)
find_package(Eigen3 REQUIRED)
find_package(Ceres REQUIRED)
# display message to user
message(STATUS "BOOST VERSION: " ${Boost_VERSION})
message(STATUS "EIGEN VERSION: " ${EIGEN3_VERSION})
message(STATUS "CERES VERSION: " ${CERES_VERSION})
# Describe catkin project
if (catkin_FOUND)
add_definitions(-DROS_AVAILABLE=1)
catkin_package(
CATKIN_DEPENDS roscpp
INCLUDE_DIRS src
LIBRARIES ${PROJECT_NAME}
)
else()
message(WARNING "CATKIN NOT FOUND BUILDING WITHOUT ROS!")
endif()
#[[
# Try to compile with c++11
# http://stackoverflow.com/a/25836953
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
]]
# Enable compile optimizations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fsee -fomit-frame-pointer -fno-signed-zeros -fno-math-errno -funroll-loops")
# Enable debug flags (use if you want to debug in gdb)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -Wmaybe-uninitialized")
# Include our header files
include_directories(
src
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${CERES_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
##################################################
# Make binary files!
##################################################
add_executable(run_record src/run_record.cpp)
target_link_libraries(run_record ${Boost_LIBRARIES} ${CERES_LIBRARIES} ${catkin_LIBRARIES})
#[[
##################################################
# Below is OpenVINS-wrapped codes
##################################################
# Find OpenVINS packages
find_package(catkin QUIET COMPONENTS rosbag tf std_msgs geometry_msgs sensor_msgs nav_msgs visualization_msgs cv_bridge)
find_package(ov_core REQUIRED)
find_package(ov_msckf REQUIRED)
find_package(ov_eval REQUIRED)
find_package(OpenCV 4 REQUIRED)
# display message to user
message(STATUS "OPENCV VERSION: " ${OpenCV_VERSION})
# Describe catkin project
if (catkin_FOUND)
add_definitions(-DROS_AVAILABLE=1)
catkin_package(
CATKIN_DEPENDS roscpp rosbag tf std_msgs geometry_msgs sensor_msgs nav_msgs visualization_msgs cv_bridge ov_core
INCLUDE_DIRS src
LIBRARIES imucalib_lib
)
else()
message(WARNING "CATKIN NOT FOUND BUILDING WITHOUT ROS!")
endif()
# Set source directories
# set(ov_core_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../ov_core)
# set(ov_msckf_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../ov_msckf)
# set(ov_eval_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../ov_eval)
# set(ov_calib_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../ov_calib)
# Include our header files
include_directories(
${ov_core_SOURCE_DIR}/src
${ov_msckf_SOURCE_DIR}/src
${ov_eval_SOURCE_DIR}/src
)
# Set link libraries used by all binaries
list(APPEND thirdparty_libraries
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
)
# If we are not building with ROS then we need to manually link to its headers
# This isn't that elegant of a way, but this at least allows for building without ROS
# See this stackoverflow answer: https://stackoverflow.com/a/11217008/7718197
if (NOT catkin_FOUND)
message(WARNING "MANUALLY LINKING TO OV_CORE LIBRARY....")
include_directories(${ov_core_SOURCE_DIR}/src/)
list(APPEND thirdparty_libraries ov_core_lib)
endif()
##################################################
# Make simulator library
##################################################
list(APPEND sim_lib_source_files
${ov_msckf_SOURCE_DIR}/src/sim/Simulator.cpp
src/sim/SimulatorMultiIMU.cpp
src/core/RosTinyVisualizer.cpp
)
add_library(sim_lib SHARED ${sim_lib_source_files})
target_link_libraries(sim_lib ${thirdparty_libraries})
target_include_directories(sim_lib PUBLIC src)
]]