-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
133 lines (98 loc) · 4.68 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
cmake_minimum_required (VERSION 3.12)
project(SoftTrunk)
add_subdirectory(mobilerack-interface)
### find and setup for Drake
# cf: https://github.com/RobotLocomotion/drake-external-examples/tree/master/drake_cmake_installed
# N.B. This is a temporary flag. It only really applies to Linux, as Mac
# does not need X11.
option(RUN_X11_TESTS "Run tests that require X11" OFF)
# include(CTest)
## commented out these lines setting up Python for Drake, since the setting of Python executable was interfering with this repo's pybind11
## so far commenting out doesn't seem to cause a problem
# if(APPLE)
# set(FIND_PYTHON_EXECUTABLE_PATHS /usr/local/opt/[email protected]/bin)
# set(FIND_PYTHON_INTERP_VERSION 3.8)
# else()
# set(FIND_PYTHON_EXECUTABLE_PATHS /usr/bin)
# set(FIND_PYTHON_INTERP_VERSION 3.6)
# endif()
# find_program(PYTHON_EXECUTABLE NAMES python3
# PATHS "${FIND_PYTHON_EXECUTABLE_PATHS}"
# NO_DEFAULT_PATH
# )
# find_package(PythonInterp ${FIND_PYTHON_INTERP_VERSION} MODULE REQUIRED)
# execute_process(COMMAND ${PYTHON_EXECUTABLE}-config --exec-prefix
# OUTPUT_VARIABLE PYTHON_EXEC_PREFIX
# OUTPUT_STRIP_TRAILING_WHITESPACE
# )
# list(APPEND CMAKE_PREFIX_PATH "${PYTHON_EXEC_PREFIX}")
# find_package(PythonLibs ${FIND_PYTHON_INTERP_VERSION} MODULE REQUIRED)
find_package(drake CONFIG REQUIRED)
# get_filename_component(PYTHONPATH
# "${drake_DIR}/../../python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages"
# REALPATH
# )
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
### END OF find and setup for Drake
# setup output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
# use this when referring to files in project from C++ source
add_definitions(-DSOFTTRUNK_PROJECT_DIR="${PROJECT_SOURCE_DIR}")
include_directories(include mobilerack-interface/include)
add_subdirectory(subm/yaml-cpp)
FIND_PACKAGE(Eigen3 REQUIRED)
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(roscpp) # this is optionally required for VisualizerROS
### libraries
ADD_LIBRARY(MotionCapture SHARED src/Sensors/MotionCapture.cpp)
TARGET_LINK_LIBRARIES(MotionCapture ${Boost_LIBRARIES} ${EIGEN3_LIBRARIES} QualisysClient fmt yaml-cpp)
ADD_LIBRARY(BendLabs SHARED src/Sensors/BendLabs.cpp)
TARGET_LINK_LIBRARIES(BendLabs ${Boost_LIBRARIES} ${EIGEN3_LIBRARIES} SerialInterface fmt yaml-cpp)
ADD_LIBRARY(StateEstimator SHARED src/StateEstimator.cpp)
TARGET_LINK_LIBRARIES(StateEstimator BendLabs MotionCapture)
add_library(AugmentedRigidArm SHARED src/Models/AugmentedRigidArm.cpp)
target_link_libraries(AugmentedRigidArm drake::drake yaml-cpp)
add_library(SoftTrunkModel SHARED src/Models/SoftTrunkModel.cpp)
target_link_libraries(SoftTrunkModel AugmentedRigidArm)
add_library(Lagrange SHARED src/Models/Lagrange.cpp)
target_link_libraries(Lagrange yaml-cpp fmt)
add_library(Model SHARED src/Model.cpp)
target_link_libraries(Model SoftTrunkModel Lagrange)
add_library(ControllerPCC SHARED src/ControllerPCC.cpp)
target_link_libraries(ControllerPCC Model StateEstimator ValveController Threads::Threads yaml-cpp)
add_library(OSC SHARED src/Controllers/OSC.cpp)
target_link_libraries(OSC ControllerPCC)
add_library(PID SHARED src/Controllers/PID.cpp)
target_link_libraries(PID ControllerPCC MiniPID)
add_library(LQR SHARED src/Controllers/LQR.cpp)
target_link_libraries(LQR ControllerPCC)
add_library(Dyn src/Controllers/Dyn.cpp)
target_link_libraries(Dyn ControllerPCC)
add_library(Characterizer src/Controllers/Characterizer.cpp)
target_link_libraries(Characterizer ControllerPCC)
add_library(IDCon src/Controllers/IDCon.cpp)
target_link_libraries(IDCon ControllerPCC)
add_library(QuasiStatic src/Controllers/QuasiStatic.cpp)
target_link_libraries(QuasiStatic ControllerPCC)
if(${roscpp_FOUND})
add_library(VisualizerROS src/VisualizerROS.cpp)
target_link_libraries(VisualizerROS SoftTrunkModel ${roscpp_LIBRARIES})
target_include_directories(VisualizerROS PUBLIC ${roscpp_INCLUDE_DIRS})
endif(${roscpp_FOUND})
### set up pybind modules
pybind11_add_module(softtrunk_pybind_module src/python_bindings.cpp)
target_link_libraries(softtrunk_pybind_module PUBLIC ControllerPCC Model StateEstimator)
if(${roscpp_FOUND})
# pybind modules for classes that require ROS
pybind11_add_module(softtrunk_ROS_pybind_module src/python_bindings_ros.cpp)
target_link_libraries(softtrunk_ROS_pybind_module PUBLIC VisualizerROS ${roscpp_LIBRARIES})
endif(${roscpp_FOUND})
add_subdirectory(apps)
add_subdirectory(experiments_IROS2021)