-
Notifications
You must be signed in to change notification settings - Fork 95
/
CMakeLists.txt
145 lines (124 loc) · 4.45 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
cmake_minimum_required(VERSION 3.0.2)
project(steering_functions)
set(PROJECT_VERSION 0.3.0)
## Build with ROS 1 by default, if it is available
if($ENV{ROS_VERSION} EQUAL 1)
option(BUILD_WITH_ROS "Build with ROS 1 support" ON)
else()
option(BUILD_WITH_ROS "Build with ROS 1 support" OFF)
endif()
## System dependencies are found with CMake's conventions
find_package(Eigen3 REQUIRED)
if(BUILD_WITH_ROS)
find_package(catkin REQUIRED COMPONENTS
roscpp
geometry_msgs
nav_msgs
visualization_msgs
costmap_2d
tf
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES steering_functions
DEPENDS EIGEN3
)
endif()
## Get all source files
file(GLOB SRC_HC_CC_SS src/hc_cc_state_space/*.cpp)
add_library(${PROJECT_NAME}
src/dubins_state_space/dubins_state_space.cpp
src/reeds_shepp_state_space/reeds_shepp_state_space.cpp
src/utilities/utilities.cpp
src/filter/ekf.cpp
${SRC_HC_CC_SS}
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
Eigen3::Eigen
)
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${PROJECT_NAME}-config-version.cmake
COMPATIBILITY AnyNewerVersion
)
install(DIRECTORY include/${PROJECT_NAME} DESTINATION include)
install(EXPORT ${PROJECT_NAME}-targets
FILE "${PROJECT_NAME}-targets.cmake"
NAMESPACE steering_functions::
DESTINATION "lib/cmake/${PROJECT_NAME}"
)
install(
FILES
"${PROJECT_NAME}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
DESTINATION "lib/cmake/${PROJECT_NAME}"
)
if(BUILD_WITH_ROS)
add_executable(${PROJECT_NAME}_node src/${PROJECT_NAME}_node.cpp)
target_link_libraries(${PROJECT_NAME}_node
PRIVATE
steering_functions
Eigen3::Eigen
${catkin_LIBRARIES}
)
target_include_directories(${PROJECT_NAME}_node
PRIVATE
${catkin_INCLUDE_DIRS}
)
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
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}
)
install(DIRECTORY
config
launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
if(CATKIN_ENABLE_TESTING)
## Add gtest based cpp test target and link libraries
catkin_add_gtest(steering_functions_test test/steering_functions_test.cpp)
if(TARGET steering_functions_test)
target_link_libraries(steering_functions_test ${catkin_LIBRARIES} ${PROJECT_NAME})
target_include_directories(steering_functions_test PRIVATE ${catkin_INCLUDE_DIRS})
endif()
catkin_add_gtest(fresnel_test test/fresnel_test.cpp)
if(TARGET fresnel_test)
target_link_libraries(fresnel_test ${catkin_LIBRARIES} ${PROJECT_NAME})
target_include_directories(fresnel_test PRIVATE ${catkin_INCLUDE_DIRS})
endif()
catkin_add_gtest(timing_test test/timing_test.cpp)
if(TARGET timing_test)
target_link_libraries(timing_test ${catkin_LIBRARIES} ${PROJECT_NAME})
target_include_directories(timing_test PRIVATE ${catkin_INCLUDE_DIRS})
endif()
catkin_add_gtest(jacobian_test test/jacobian_test.cpp)
if(TARGET jacobian_test)
target_link_libraries(jacobian_test ${catkin_LIBRARIES} ${PROJECT_NAME})
target_include_directories(jacobian_test PRIVATE ${catkin_INCLUDE_DIRS})
endif()
catkin_add_gtest(hc_cc_circle_test test/hc_cc_circle_test.cpp)
if(TARGET hc_cc_circle_test)
target_link_libraries(hc_cc_circle_test ${catkin_LIBRARIES} ${PROJECT_NAME})
target_include_directories(hc_cc_circle_test PRIVATE ${catkin_INCLUDE_DIRS})
endif()
endif()
endif()