-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
107 lines (90 loc) · 2.87 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
cmake_minimum_required( VERSION 3.16.3 )
project( arx5-sdk )
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # global PIC
find_package(Threads REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(orocos_kdl REQUIRED)
find_package(kdl_parser REQUIRED)
find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(Boost REQUIRED COMPONENTS container)
set(ARX_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DARX_DIRECTORY="${ARX_DIRECTORY}") # TODO: remove this
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*|arm|aarch64")
set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/aarch64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64)|(^i686)")
set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/x86_64)
endif()
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories(
$ENV{CONDA_PREFIX}/include/
$ENV{CONDA_PREFIX}/include/urdfdom_headers
)
add_library(ArxJointController SHARED
src/app/joint_controller.cpp
src/utils.cpp
)
target_link_libraries(ArxJointController
${LIB_DIR}/libhardware.so
${LIB_DIR}/libsolver.so
Eigen3::Eigen
Threads::Threads
spdlog::spdlog
kdl_parser
orocos-kdl
soem
)
add_library(ArxCartesianController SHARED
src/app/cartesian_controller.cpp
src/utils.cpp
)
target_link_libraries(ArxCartesianController
${LIB_DIR}/libhardware.so
${LIB_DIR}/libsolver.so
Eigen3::Eigen
Threads::Threads
spdlog::spdlog
kdl_parser
orocos-kdl
soem
)
# Hack for py310 (conda environment is slightly different from other python versions)
target_include_directories(ArxJointController PUBLIC $ENV{CONDA_PREFIX}/include/kdl_parser $ENV{CONDA_PREFIX}/include/urdfdom_headers)
target_include_directories(ArxCartesianController PUBLIC $ENV{CONDA_PREFIX}/include/kdl_parser $ENV{CONDA_PREFIX}/include/urdfdom_headers)
add_executable(test_joint_controller examples/test_joint_controller.cpp)
target_link_libraries(test_joint_controller
${LIB_DIR}/libhardware.so
${LIB_DIR}/libsolver.so
ArxJointController
Eigen3::Eigen
Threads::Threads
spdlog::spdlog
kdl_parser
orocos-kdl
soem
)
add_executable(test_cartesian_controller examples/test_cartesian_controller.cpp)
target_link_libraries(test_cartesian_controller
${LIB_DIR}/libhardware.so
${LIB_DIR}/libsolver.so
ArxCartesianController
spdlog::spdlog
Eigen3::Eigen
Threads::Threads
kdl_parser
orocos-kdl
soem
)
add_subdirectory(python)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}
)
install(FILES ${LIB_DIR}/libhardware.so ${LIB_DIR}/libsolver.so
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}
)
install(TARGETS ArxJointController ArxCartesianController
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}
)