forked from TAMS-Group/bio_ik
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
199 lines (171 loc) · 5.36 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
cmake_minimum_required(VERSION 3.15)
project(bio_ik)
include(cmake/StandardProjectSettings.cmake)
# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_20)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if(ENABLE_BUILD_WITH_TIME_TRACE)
target_compile_options(project_options INTERFACE -ftime-trace)
endif()
endif()
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)
# enable cache system
# include(cmake/Cache.cmake)
# Add linker configuration
include(cmake/Linker.cmake)
configure_linker(project_options)
# standard compiler warnings
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
# sanitizer options if supported by compiler
include(cmake/Sanitizers.cmake)
enable_sanitizers(project_options)
# enable doxygen
include(cmake/Doxygen.cmake)
enable_doxygen()
# allow for static analysis options
include(cmake/StaticAnalyzers.cmake)
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(backward_ros REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(fmt REQUIRED)
find_package(fp REQUIRED)
find_package(moveit_core REQUIRED)
find_package(moveit_ros_planning REQUIRED)
find_package(pluginlib REQUIRED)
find_package(range-v3 REQUIRED)
find_package(rclcpp REQUIRED)
find_package(tf2_kdl REQUIRED)
find_package(kdl_parser REQUIRED)
find_package(fcl REQUIRED)
# TODO(tylerjw): re-enable these
# find_package(OpenMP)
# # the specific flag is not yet present in cmake 2.8.12
# if(OpenMP_CXX_FOUND OR OPENMP_FOUND)
# message(STATUS "OPENMP FOUND")
# add_compile_options(${OpenMP_CXX_FLAGS})
# if(NOT OpenMP_CXX_LIBRARIES)
# # cmake 2.8.12 does not yet specify the library - assume we might need libgomp
# set(OpenMP_LIBS gomp)
# else()
# set(OpenMP_LIBS ${OpenMP_CXX_LIBRARIES})
# endif()
# else()
# message(WARNING "OPENMP NOT FOUND. You will suffer performance loss.")
# set(OpenMP_LIBS)
# endif()
# TODO(tylerjw) re-enable optimizations
# if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# add_compile_options(-frecord-gcc-switches)
# endif()
# add_compile_options(-std=c++11)
# add_compile_options($<$<CONFIG:Release>:-O3>)
# add_compile_options($<$<CONFIG:Release>:-ftree-vectorize>)
# add_compile_options($<$<CONFIG:Release>:-ffast-math>)
set(SOURCES
src/goal_types.cpp
src/ik_evolution_1.cpp
src/ik_evolution_2.cpp
src/ik_gradient.cpp
src/ik_test.cpp
src/parameters.cpp
src/problem.cpp
)
# TODO(tylerjw): re-enable this
# if(USE_FANN)
# list(APPEND SOURCES src/ik_neural.cpp)
# endif()
# include_directories(
# include
# ${FANN_INCLUDE_DIRS}
# ${CPPOPTLIB_INCLUDE_DIRS}
# )
add_library(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> ${tf2_kdl_INCLUDE_DIRS} ${kdl_parser_INCLUDE_DIRS})
target_link_libraries(
${PROJECT_NAME}
PRIVATE
project_options
project_warnings
PUBLIC
Eigen3::Eigen
fmt::fmt
fp::fp
moveit_core::moveit_collision_detection_fcl
moveit_core::moveit_kinematics_base
moveit_core::moveit_robot_model
moveit_ros_planning::moveit_rdf_loader
range-v3::range-v3
rclcpp::rclcpp
fcl
tf2_kdl::tf2_kdl
)
add_library(${PROJECT_NAME}_plugin
${SOURCES}
src/kinematics_plugin.cpp
)
target_include_directories(${PROJECT_NAME}_plugin PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(
${PROJECT_NAME}_plugin
PRIVATE
project_options
project_warnings
bio_ik
)
option(BUILD_TESTING "Enable Test Builds" ON)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following lines skip linters
set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt
set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black
set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format
ament_lint_auto_find_test_dependencies()
add_subdirectory(test)
endif()
# TODO(tylerjw): re-enable this
# set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION})
# TODO(tylerjw): visibility-headers
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
# target_compile_definitions(${PROJECT_NAME} PRIVATE "${PROJECT_NAME}_BUILDING_LIBRARY")
install(DIRECTORY include/
DESTINATION include)
install(
TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_plugin
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
pluginlib_export_plugin_description_file(
moveit_core
bio_ik_kinematics_description.xml
)
ament_export_include_directories(
include
)
ament_export_libraries(
${PROJECT_NAME}_plugin
)
ament_export_targets(
export_${PROJECT_NAME}
)
ament_export_dependencies(fmt)
ament_export_dependencies(fp)
ament_export_dependencies(range-v3)
ament_export_dependencies(moveit_ros_planning)
ament_export_dependencies(fmt)
ament_export_dependencies(fp)
ament_export_dependencies(range-v3)
ament_export_dependencies(tf2_kdl)
ament_package()