-
Notifications
You must be signed in to change notification settings - Fork 93
/
CMakeLists.txt
138 lines (114 loc) · 3.35 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
cmake_minimum_required(VERSION 2.8.3)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0.2")
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
endif()
project(image_undistort)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Set compile flags (-Ofast actually makes a big difference over -O3 here (maybe 20% faster)
if(${CMAKE_VERSION} VERSION_LESS "3.1.0")
set(CMAKE_CXX_FLAGS "-std=c++11 -Ofast")
else()
set(CMAKE_CXX_FLAGS "-Ofast")
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(Eigen3 REQUIRED)
find_package(catkin REQUIRED COMPONENTS
roscpp
roslib
pcl_ros
sensor_msgs
cv_bridge
image_transport
tf_conversions
nodelet
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}_nodelet
)
find_package(OpenCV REQUIRED COMPONENTS core calib3d)
find_package(NLOPT)
IF(${NLOPT_FOUND})
include_directories(
${NLOPT_INCLUDE_DIRS}
)
add_library(${PROJECT_NAME}_nodelet
src/nodelets/image_undistort_nodelet.cpp
src/nodelets/stereo_info_nodelet.cpp
src/nodelets/stereo_undistort_nodelet.cpp
src/nodelets/depth_nodelet.cpp
src/nodelets/point_to_bearing_nodelet.cpp
src/stereo_info.cpp
src/stereo_undistort.cpp
src/depth.cpp
src/camera_parameters.cpp
src/image_undistort.cpp
src/undistorter.cpp
src/point_to_bearing.cpp)
ELSE()
add_library(${PROJECT_NAME}_nodelet
src/nodelets/image_undistort_nodelet.cpp
src/nodelets/stereo_info_nodelet.cpp
src/nodelets/stereo_undistort_nodelet.cpp
src/nodelets/depth_nodelet.cpp
src/stereo_info.cpp
src/stereo_undistort.cpp
src/depth.cpp
src/camera_parameters.cpp
src/image_undistort.cpp
src/undistorter.cpp)
MESSAGE(WARNING "nlopt not found, building without point to bearing nodelet")
ENDIF()
include_directories(
include
${EIGEN3_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}_nodelet
${catkin_LIBRARIES} ${OpenCV_LIBRARIES}
)
add_dependencies(${PROJECT_NAME}_nodelet ${catkin_EXPORTED_TARGETS})
add_executable(image_undistort_node src/nodes/image_undistort_node.cpp)
target_link_libraries(image_undistort_node
${catkin_LIBRARIES} ${OpenCV_LIBRARIES}
)
add_executable(stereo_info_node src/nodes/stereo_info_node.cpp)
target_link_libraries(stereo_info_node
${catkin_LIBRARIES} ${OpenCV_LIBRARIES}
)
add_executable(stereo_undistort_node src/nodes/stereo_undistort_node.cpp)
target_link_libraries(stereo_undistort_node
${catkin_LIBRARIES} ${OpenCV_LIBRARIES}
)
add_executable(depth_node src/nodes/depth_node.cpp)
target_link_libraries(depth_node
${catkin_LIBRARIES} ${OpenCV_LIBRARIES}
)
add_executable(dense_stereo_node src/nodes/dense_stereo_node.cpp)
target_link_libraries(dense_stereo_node
${catkin_LIBRARIES} ${OpenCV_LIBRARIES}
)
IF(${NLOPT_FOUND})
add_executable(point_to_bearing_node src/nodes/point_to_bearing_node.cpp)
target_link_libraries(point_to_bearing_node
${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${NLOPT_LIBRARIES}
)
ENDIF()
# Install nodelet library
install(TARGETS ${PROJECT_NAME}_nodelet
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
# Install header files
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
# Install launch files
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
# Install xml files
install(FILES nodelet_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)