-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
149 lines (119 loc) · 4.18 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
cmake_minimum_required(VERSION 3.5)
project(geolib2)
add_compile_options(-Wall -Werror=all)
add_compile_options(-Wextra -Werror=extra)
find_package(catkin REQUIRED COMPONENTS
code_profiler
cv_bridge
image_geometry
sensor_msgs
shape_msgs
tf
tf2
)
set(CMAKE_POLICY_DEFAULT_CMP0012 NEW) # Fixed in Assimp 5.1.0, but is not released on Ubuntu Focal
find_package(ASSIMP REQUIRED)
find_package(console_bridge REQUIRED)
find_package(OpenCV REQUIRED)
catkin_package(
INCLUDE_DIRS include
LIBRARIES geolib
CATKIN_DEPENDS cv_bridge sensor_msgs shape_msgs tf
DEPENDS ASSIMP OpenCV console_bridge
)
###########
## Build ##
###########
include_directories(
include
SYSTEM
${ASSIMP_INCLUDE_DIRS}
${console_bridge_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
# to show header files in Qt Creator
file(GLOB_RECURSE HEADER_FILES include/*.h)
if(EXISTS "/usr/include/assimp/Importer.hpp" OR EXISTS "/usr/local/include/assimp/Importer.hpp" )
add_definitions(-DASSIMP_VERSION_3)
endif()
## Declare a cpp library
add_library(geolib
${HEADER_FILES}
src/Box.cpp
src/CompositeShape.cpp
src/HeightMap.cpp
src/HeightMapNode.cpp
src/Mesh.cpp
src/Octree.cpp
src/OctreeNode.cpp
src/Ray.cpp
src/Shape.cpp
src/Triangle.cpp
src/io/export.cpp
src/io/import.cpp
src/ros/msg_conversions.cpp
src/sensors/DepthCamera.cpp
src/sensors/LaserRangeFinder.cpp
src/serialization.cpp
src/shapes.cpp
src/visualization.cpp
)
target_link_libraries(geolib ${ASSIMP_LIBRARIES} ${catkin_LIBRARIES} ${console_bridge_LIBRARIES} ${OpenCV_LIBRARIES})
# ------------------------------------------------------------------------------------------------
# TOOLS
# ------------------------------------------------------------------------------------------------
add_executable(height-map-to-file tools/height_image_to_file.cpp)
target_link_libraries(height-map-to-file geolib)
add_executable(height-map-to-shape tools/height_image_to_shape.cpp)
target_link_libraries(height-map-to-shape geolib)
add_executable(show tools/show.cpp)
target_link_libraries(show geolib)
# ------------------------------------------------------------------------------------------------
# TESTS
# ------------------------------------------------------------------------------------------------
add_executable(test_geolib test/test_geolib.cpp)
target_link_libraries(test_geolib geolib)
add_executable(test_geolib_lrf test/test_geolib_lrf.cpp)
target_link_libraries(test_geolib_lrf geolib)
add_executable(test_matrix test/test_matrix.cpp)
target_link_libraries(test_matrix geolib)
# ------------------------------------------------------------------------------------------------
# INSTALL
# ------------------------------------------------------------------------------------------------
install(
DIRECTORY include/
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
)
install(
TARGETS
geolib
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(
TARGETS
height-map-to-file
height-map-to-shape
show
test_geolib
test_geolib_lrf
test_matrix
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# ------------------------------------------------------------------------------------------------
# UNIT TESTS
# ------------------------------------------------------------------------------------------------
if(CATKIN_ENABLE_TESTING)
find_package(catkin_lint_cmake REQUIRED)
catkin_add_catkin_lint_test("-W2 --ignore HEADER_OUTSIDE_PACKAGE_INCLUDE_PATH")
catkin_add_gtest(test_box test/test_box.cpp)
target_link_libraries(test_box geolib)
catkin_add_gtest(test_composite_shape test/test_composite_shape.cpp)
target_link_libraries(test_composite_shape geolib)
catkin_add_gtest(test_shape test/test_shape.cpp)
target_link_libraries(test_shape geolib)
catkin_add_gtest(test_lrf test/test_lrf.cpp)
target_link_libraries(test_lrf geolib)
endif()