-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (82 loc) · 3.08 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
cmake_minimum_required(VERSION 3.16)
project(kinematics_library
VERSION 0.1
DESCRIPTION "A framework for handling serial robot kinematics"
)
set(TARGET_NAME ${PROJECT_NAME})
find_package(PkgConfig REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Threads REQUIRED)
set(DEPENDENCIES
orocos_kdl
kdl_parser
urdfdom
urdfdom_headers
yaml-cpp
base-logging
base-types
)
set (SRCS
${PROJECT_SOURCE_DIR}/src/abstract/AbstractKinematics.cpp
${PROJECT_SOURCE_DIR}/src/HandleKinematicConfig.cpp
${PROJECT_SOURCE_DIR}/src/abstract/IkFastSolver.cpp
${PROJECT_SOURCE_DIR}/src/abstract/KdlSolver.cpp
${PROJECT_SOURCE_DIR}/src/abstract/KinematicsHelper.cpp
${PROJECT_SOURCE_DIR}/src/solver/shimizu_method/SRSKinematicSolver.cpp
${PROJECT_SOURCE_DIR}/src/solver/shimizu_method/SRSKinematicHelper.cpp
${PROJECT_SOURCE_DIR}/src/solver/asfour_method/IK7DoFSolver.cpp
${PROJECT_SOURCE_DIR}/src/KinematicsFactory.cpp )
# if trac_ik is found, add it to the kinematic factory
pkg_check_modules(TRAC_IK trac_ik)
if(${TRAC_IK_FOUND})
message ("TRAC_IK found !")
add_definitions(-DTRAC_IK_LIB_FOUND=1)
LIST(APPEND SRCS ${PROJECT_SOURCE_DIR}/src/abstract/TracIkSolver.cpp)
list(APPEND DEPENDENCIES trac_ik)
else(${TRAC_IK_FOUND})
message ("TRAC_IK not found !")
endif()
# if nlopt is found, add it to the kinematic factory
pkg_check_modules(NLOPT nlopt)
if(${NLOPT_FOUND})
message ("NLopt found !")
add_definitions(-DOPT_LIB_FOUND=1)
LIST(APPEND SRCS ${PROJECT_SOURCE_DIR}/src/solver/optimization_method/ProblemFormulation.cpp)
LIST(APPEND SRCS ${PROJECT_SOURCE_DIR}/src/solver/optimization_method/OptSolver.cpp)
LIST(APPEND SRCS ${PROJECT_SOURCE_DIR}/src/solver/optimization_method/HybridIkSolver.cpp)
list(APPEND DEPENDENCIES nlopt)
else(${NLOPT_FOUND})
message ("NLOPT not found !")
message ("-------------------------------------------------------------------------")
message (" ")
message ("Optimization-based kinematics libraries (OptIK & HybridIK) won't be build")
message (" ")
message ("-------------------------------------------------------------------------")
endif()
pkg_check_modules(Dependencies REQUIRED IMPORTED_TARGET ${DEPENDENCIES})
# Build the library
add_library(${TARGET_NAME} SHARED ${SRCS})
target_link_libraries(${TARGET_NAME}
PUBLIC
PkgConfig::Dependencies
Threads::Threads
Eigen3::Eigen
${CMAKE_DL_LIBS}
)
target_include_directories(${TARGET_NAME}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
list(JOIN DEPENDENCIES " " PKGCONFIG_REQUIRES)
configure_file("${PROJECT_NAME}.pc.in" "${PROJECT_NAME}.pc" @ONLY)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/kinematics_library DESTINATION include)
install(TARGETS ${TARGET_NAME} DESTINATION lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
# Build the test
add_executable(test_kinematics_library
test/test_kinematics_library.cpp
)
target_link_libraries(test_kinematics_library
${TARGET_NAME}
)