-
Notifications
You must be signed in to change notification settings - Fork 82
/
CMakeLists.txt
134 lines (113 loc) · 3.54 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
cmake_minimum_required(VERSION 3.0.2)
project(bio_ik)
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message("${PROJECT_NAME}: You did not request a specific build type: Choosing 'Release' for maximum performance")
set(CMAKE_BUILD_TYPE Release)
endif()
find_package(catkin REQUIRED COMPONENTS
eigen_conversions
moveit_core
moveit_ros_planning
pluginlib
roscpp
tf2
tf2_eigen
tf2_kdl
tf2_geometry_msgs
tf_conversions
)
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()
option(USE_FANN "build the neural-network-based IK solver (experimental)" OFF)
if(USE_FANN)
find_library(FANN_LIBRARIES NAMES fann)
find_path(FANN_INCLUDE_DIRS NAMES fann.h)
if(NOT FANN_INCLUDE_DIRS OR NOT FANN_LIBRARIES)
message(FATAL_ERROR "Neural network solver requested, but libfann was not found.")
else()
message("Found libfann: ${FANN_LIBRARIES} / ${FANN_INCLUDE_DIRS}")
endif()
else()
set(FANN_LIBRARIES)
set(FANN_INCLUDE_DIRS)
endif()
option(USE_CPPOPTLIB "Include gradient-based solvers from CppNumericalSolvers (bio_ik also provides its own solver)" OFF)
if(USE_CPPOPTLIB)
find_path(CPPOPTLIB_INCLUDE_DIRS
NAMES cppoptlib/solver/bfgssolver.h
HINTS ../../CppNumericalSolvers/include)
if(NOT CPPOPTLIB_INCLUDE_DIRS)
message(FATAL_ERROR "cppoptlib support requested, but the headers could not be found.")
else()
message("Found cppoptlib: ${CPPOPTLIB_INCLUDE_DIRS}")
endif()
add_definitions(-DENABLE_CPP_OPTLIB)
else()
set(CPPOPTLIB_INCLUDE_DIRS)
endif()
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS
eigen_conversions
moveit_core
moveit_ros_planning
pluginlib
roscpp
tf2
tf2_kdl
tf2_geometry_msgs
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-frecord-gcc-switches)
endif()
add_compile_options($<$<CONFIG:Release>:-O3>)
add_compile_options($<$<CONFIG:Release>:-ftree-vectorize>)
add_compile_options($<$<CONFIG:Release>:-ffast-math>)
include_directories(
include
${FANN_INCLUDE_DIRS}
${CPPOPTLIB_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
set(SOURCES
src/goal_types.cpp
src/kinematics_plugin.cpp
src/problem.cpp
src/ik_test.cpp
src/ik_gradient.cpp
src/ik_evolution_1.cpp
src/ik_evolution_2.cpp
)
if(USE_FANN)
list(APPEND SOURCES src/ik_neural.cpp)
endif()
if(USE_CPPOPTLIB)
list(APPEND SOURCES src/ik_cppoptlib.cpp)
endif()
add_library(${PROJECT_NAME} ${SOURCES})
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION})
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${FANN_LIBRARIES}
${OpenMP_LIBS}
-static-libgcc
-static-libstdc++
)
install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(FILES bio_ik_kinematics_description.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})