-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists2.txt
116 lines (99 loc) · 2.77 KB
/
CMakeLists2.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
cmake_minimum_required(VERSION 3.5)
project(guidance_planner)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
# OPENMP (for parallel computation)
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else()
message(WARNING "Compiling without OPENMP (OPENMP not found)")
endif()
# General requirements
set(DEPENDENCIES
rclcpp
std_msgs
ros_tools
)
# GSL (for integration)
find_package(PkgConfig REQUIRED)
pkg_check_modules(gsl REQUIRED gsl)
find_package(ament_cmake REQUIRED)
foreach(pkg IN LISTS DEPENDENCIES)
find_package(${pkg} REQUIRED)
endforeach()
include_directories(
include
)
add_library(${PROJECT_NAME}_homotopy SHARED
src/homotopy_comparison/uvd.cpp
src/homotopy_comparison/winding_angle.cpp
src/homotopy_comparison/homology.cpp
)
target_include_directories(${PROJECT_NAME}_homotopy PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
ament_target_dependencies(${PROJECT_NAME}_homotopy ros_tools)
target_link_libraries(${PROJECT_NAME}_homotopy ${gsl_LIBRARIES})
# Library
add_library(${PROJECT_NAME} SHARED
# src/config.cpp
# src/paths.cpp
# src/types.cpp
# src/global_guidance.cpp
# src/prm.cpp
# src/graph.cpp
# src/environment.cpp
# src/graph_search.cpp
# src/cubic_spline.cpp
src/config.cpp
src/global_guidance.cpp
src/prm.cpp
src/sampler.cpp
src/graph.cpp
src/graph_search.cpp
src/types/paths.cpp
src/types/types.cpp
src/types/node.cpp
src/types/connection.cpp
src/environment.cpp
src/cubic_spline.cpp
src/third_party/dubins.cpp
)
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
ament_target_dependencies(${PROJECT_NAME} ${DEPENDENCIES})
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_homotopy ${gsl_LIBRARIES})
# Example
add_executable(example src/ros2_example.cpp)
target_link_libraries(example ${PROJECT_NAME})
## INSTALL
install(
TARGETS
${PROJECT_NAME}_homotopy
${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
install(TARGETS example
DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY include/
DESTINATION include/${PROJECT_NAME})
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY config
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY rviz
DESTINATION share/${PROJECT_NAME})
## FINALIZE
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(${DEPENDENCIES})
ament_package()