-
Notifications
You must be signed in to change notification settings - Fork 26
/
CMakeLists.txt
150 lines (132 loc) · 4.25 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
cmake_minimum_required(VERSION 2.8.3)
project(gl_depth_sim)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall -Wextra)
find_package(catkin REQUIRED COMPONENTS
roscpp # Used for ROS examples
pcl_ros # Used for interfaces extension
tf2_ros # Used for ROS example
tf2_eigen # Used for ROS example
visualization_msgs # Used for ROS example
)
# Required for core functionality
find_package(glfw3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Eigen3 REQUIRED)
# Extensions
find_package(assimp REQUIRED) # Just used for loading models in mesh_loader.h
find_package(OpenCV REQUIRED) # Used for interface extension
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}_interfaces
CATKIN_DEPENDS
roscpp
pcl_ros
tf2_ros
tf2_eigen
visualization_msgs
DEPENDS OpenCV
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)
# Primary rendering library
# Independent of ROS, but does need glfw3 and assimp for model loading
add_library(${PROJECT_NAME}
src/${PROJECT_NAME}/sim_depth_camera.cpp
src/${PROJECT_NAME}/mesh_loader.cpp
src/${PROJECT_NAME}/mesh.cpp
src/${PROJECT_NAME}/renderable_mesh.cpp
src/${PROJECT_NAME}/shader_program.cpp
src/${PROJECT_NAME}/glad.c
src/${PROJECT_NAME}/glfw_guard.cpp
)
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}
${OPENGL_LIBRARIES}
${ASSIMP_LIBRARIES}
dl
glfw
)
# Libaries for interfacing with opencv and pcl
add_library(${PROJECT_NAME}_interfaces
src/interfaces/pcl_interface.cpp
src/interfaces/opencv_interface.cpp
)
add_dependencies(${PROJECT_NAME}_interfaces ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_interfaces
${PROJECT_NAME}
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
# Simulated laser scanner library
add_library(${PROJECT_NAME}_sim_laser_scanner
src/${PROJECT_NAME}/sim_laser_scanner.cpp
)
add_dependencies(${PROJECT_NAME}_interfaces ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_sim_laser_scanner
${catkin_LIBRARIES}
${PROJECT_NAME}
${PROJECT_NAME}_interfaces
)
# Example showing basic usage
add_executable(${PROJECT_NAME}_test src/usage_example.cpp)
set_target_properties(${PROJECT_NAME}_test PROPERTIES OUTPUT_NAME depth_example PREFIX "")
target_link_libraries(${PROJECT_NAME}_test
${PROJECT_NAME}
${PROJECT_NAME}_interfaces
${catkin_LIBRARIES}
)
# Example showing an orbiting camera
add_executable(${PROJECT_NAME}_orbit src/camera_orbit_example.cpp)
set_target_properties(${PROJECT_NAME}_orbit PROPERTIES OUTPUT_NAME orbit_example PREFIX "")
target_link_libraries(${PROJECT_NAME}_orbit
${PROJECT_NAME}
${PROJECT_NAME}_interfaces
${catkin_LIBRARIES}
)
# Example showing orbiting camera with point cloud publishing in ROS
add_executable(${PROJECT_NAME}_ros_orbit src/camera_ros_example.cpp)
set_target_properties(${PROJECT_NAME}_ros_orbit PROPERTIES OUTPUT_NAME ros_example PREFIX "")
target_link_libraries(${PROJECT_NAME}_ros_orbit
${PROJECT_NAME}
${PROJECT_NAME}_interfaces
${catkin_LIBRARIES}
)
# Example showing sweeping laser scan with point cloud publishing in ROS
add_executable(${PROJECT_NAME}_laser_example src/laser_example.cpp)
set_target_properties(${PROJECT_NAME}_laser_example PROPERTIES OUTPUT_NAME laser_example PREFIX "")
target_link_libraries(${PROJECT_NAME}_laser_example
${PROJECT_NAME}_sim_laser_scanner
${catkin_LIBRARIES}
)
install(
TARGETS
${PROJECT_NAME}
${PROJECT_NAME}_interfaces
${PROJECT_NAME}_sim_laser_scanner
${PROJECT_NAME}_test
${PROJECT_NAME}_orbit
${PROJECT_NAME}_ros_orbit
${PROJECT_NAME}_laser_example
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
#############
## Testing ##
#############
#if(CATKIN_ENABLE_TESTING)
# find_package(rostest REQUIRED)
# catkin_add_gtest(utest_node test/utest.cpp)
# target_link_libraries(utest_node
# ${catkin_LIBRARIES}
# ${PROJECT_NAME}_sim_laser_scanner
# )
#endif()