-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
192 lines (158 loc) · 7.48 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
cmake_minimum_required(VERSION 3.5)
project(SoftRobots.Inverse VERSION 1.0)
# CMAKE_PREFIX_PATH must contain:
# - SOFA install dir
# - SoftRobots install dir
# - STLIB install dir
include(cmake/environment.cmake)
find_package(Sofa.Config REQUIRED)
sofa_find_package(SoftRobots REQUIRED)
sofa_find_package(Sofa.Component.Constraint.Lagrangian.Solver REQUIRED)
sofa_find_package(Sofa.Component.Collision.Response.Contact REQUIRED)
set(SRC_DIR "src/SoftRobots.Inverse")
set(HEADER_FILES
${SRC_DIR}/component/config.h.in
# EFFECTOR
${SRC_DIR}/component/behavior/Effector.h
${SRC_DIR}/component/behavior/Effector.inl
${SRC_DIR}/component/constraint/BarycentricCenterEffector.h
${SRC_DIR}/component/constraint/BarycentricCenterEffector.inl
${SRC_DIR}/component/constraint/CableEffector.h
${SRC_DIR}/component/constraint/CableEffector.inl
${SRC_DIR}/component/constraint/PositionEffector.h
${SRC_DIR}/component/constraint/PositionEffector.inl
${SRC_DIR}/component/constraint/VolumeEffector.h
${SRC_DIR}/component/constraint/VolumeEffector.inl
# ACTUATOR
${SRC_DIR}/component/behavior/Actuator.h
${SRC_DIR}/component/behavior/Actuator.inl
${SRC_DIR}/component/constraint/YoungModulusActuator.h
${SRC_DIR}/component/constraint/YoungModulusActuator.inl
${SRC_DIR}/component/constraint/CableActuator.h
${SRC_DIR}/component/constraint/CableActuator.inl
${SRC_DIR}/component/constraint/ForceSurfaceActuator.h
${SRC_DIR}/component/constraint/ForceSurfaceActuator.inl
${SRC_DIR}/component/constraint/ForcePointActuator.h
${SRC_DIR}/component/constraint/ForcePointActuator.inl
${SRC_DIR}/component/constraint/JointActuator.h
${SRC_DIR}/component/constraint/JointActuator.inl
${SRC_DIR}/component/constraint/SlidingActuator.h
${SRC_DIR}/component/constraint/SlidingActuator.inl
${SRC_DIR}/component/constraint/SurfacePressureActuator.h
${SRC_DIR}/component/constraint/SurfacePressureActuator.inl
# SENSOR
${SRC_DIR}/component/behavior/Sensor.h
${SRC_DIR}/component/behavior/Sensor.inl
${SRC_DIR}/component/constraint/CableSensor.h
${SRC_DIR}/component/constraint/CableSensor.inl
${SRC_DIR}/component/constraint/SurfacePressureSensor.h
${SRC_DIR}/component/constraint/SurfacePressureSensor.inl
# EQUALITY
${SRC_DIR}/component/behavior/Equality.h
${SRC_DIR}/component/behavior/Equality.inl
${SRC_DIR}/component/constraint/CableEquality.h
${SRC_DIR}/component/constraint/CableEquality.inl
${SRC_DIR}/component/constraint/PositionEquality.h
${SRC_DIR}/component/constraint/PositionEquality.inl
${SRC_DIR}/component/constraint/SurfacePressureEquality.h
${SRC_DIR}/component/constraint/SurfacePressureEquality.inl
${SRC_DIR}/component/solver/QPInverseProblemSolver.h
${SRC_DIR}/component/solver/modules/ContactHandler.h
${SRC_DIR}/component/solver/modules/ConstraintHandler.h
${SRC_DIR}/component/solver/modules/LCPQPSolver.h
${SRC_DIR}/component/solver/modules/NLCPSolver.h
${SRC_DIR}/component/solver/modules/QPInverseProblem.h
${SRC_DIR}/component/solver/modules/QPInverseProblemImpl.h
${SRC_DIR}/component/solver/modules/QPMechanicalAccumulateConstraint.h
${SRC_DIR}/component/solver/modules/QPMechanicalSetConstraint.h
)
set(SOURCE_FILES
${SRC_DIR}/component/initSoftRobotsInverse.cpp
# EFFECTOR
${SRC_DIR}/component/behavior/Effector.cpp
${SRC_DIR}/component/constraint/BarycentricCenterEffector.cpp
${SRC_DIR}/component/constraint/CableEffector.cpp
${SRC_DIR}/component/constraint/PositionEffector.cpp
${SRC_DIR}/component/constraint/VolumeEffector.cpp
# ACTUATOR
${SRC_DIR}/component/behavior/Actuator.cpp
${SRC_DIR}/component/constraint/YoungModulusActuator.cpp
${SRC_DIR}/component/constraint/CableActuator.cpp
${SRC_DIR}/component/constraint/ForceSurfaceActuator.cpp
${SRC_DIR}/component/constraint/ForcePointActuator.cpp
${SRC_DIR}/component/constraint/JointActuator.cpp
${SRC_DIR}/component/constraint/SlidingActuator.cpp
${SRC_DIR}/component/constraint/SurfacePressureActuator.cpp
# SENSOR
${SRC_DIR}/component/behavior/Sensor.cpp
${SRC_DIR}/component/constraint/CableSensor.cpp
${SRC_DIR}/component/constraint/SurfacePressureSensor.cpp
# EQUALITY
${SRC_DIR}/component/behavior/Equality.cpp
${SRC_DIR}/component/constraint/CableEquality.cpp
${SRC_DIR}/component/constraint/PositionEquality.cpp
${SRC_DIR}/component/constraint/SurfacePressureEquality.cpp
${SRC_DIR}/component/solver/QPInverseProblemSolver.cpp
${SRC_DIR}/component/solver/modules/ContactHandler.cpp
${SRC_DIR}/component/solver/modules/ConstraintHandler.cpp
${SRC_DIR}/component/solver/modules/LCPQPSolver.cpp
${SRC_DIR}/component/solver/modules/NLCPSolver.cpp
${SRC_DIR}/component/solver/modules/QPInverseProblem.cpp
${SRC_DIR}/component/solver/modules/QPInverseProblemImpl.cpp
${SRC_DIR}/component/solver/modules/QPMechanicalAccumulateConstraint.cpp
${SRC_DIR}/component/solver/modules/QPMechanicalSetConstraint.cpp
)
if(SOFA-DEVPLUGIN_BEAMADAPTER)
list(APPEND HEADER_FILES
${SRC_DIR}/component/constraint/BeamRestPositionActuator.h
${SRC_DIR}/component/constraint/BeamRestPositionActuator.inl
)
list(APPEND SOURCE_FILES
${SRC_DIR}/component/constraint/BeamRestPositionActuator.cpp
)
endif()
set(DOC_FILES README.md)
file(GLOB_RECURSE EXAMPLE_FILES examples "*.pyscn" "*.py" "*.md" "*.psl" "*.pslx" "*.scn" "*.xml")
set(OASES_LIBRARY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/extlibs/qpOASES-3.2.0/")
add_subdirectory(${OASES_LIBRARY_DIRECTORY} extlibs/libqpOASES)
find_package(libqpOASES REQUIRED)
message("libqpOASES_INCLUDE_DIRS = ${libqpOASES_INCLUDE_DIRS}")
include_directories(${libqpOASES_INCLUDE_DIRS})
set(QPOASES_INCLUDE_DIR ${libqpOASES_INCLUDE_DIRS} CACHE INTERNAL "")
sofa_install_libraries(PATHS ${libqpOASES_LIBRARY})
option(SOFTROBOTSINVERSE_INSTALL_HEADERS "Install the headers" ON)
if(SOFTROBOTSINVERSE_INSTALL_HEADERS)
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${DOC_FILES} ${EXAMPLE_FILES} ${HEADER_FILES})
else()
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${DOC_FILES} ${EXAMPLE_FILES} "${SRC_DIR}/component/config.h.in")
endif()
target_link_libraries(${PROJECT_NAME}
SoftRobots
Sofa.Component.Constraint.Lagrangian.Solver
Sofa.Component.Collision.Response.Contact)
target_link_libraries(${PROJECT_NAME} ${libqpOASES_LIBRARY})
sofa_find_package(Sofa.Component.SolidMechanics.FEM.Elastic)
target_link_libraries(${PROJECT_NAME} Sofa.Component.SolidMechanics.FEM.Elastic)
find_package(SofaPython3 QUIET)
if(SofaPython3_FOUND)
add_subdirectory(${SRC_DIR}/binding)
endif()
## Install rules for the library and headers; CMake package configurations files
sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
PACKAGE_VERSION ${PROJECT_VERSION}
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES
INCLUDE_SOURCE_DIR "src"
INCLUDE_INSTALL_DIR ${PROJECT_NAME}
RELOCATABLE "plugins"
)
install(DIRECTORY docs DESTINATION .)
install(FILES "README.md" "LICENSE.AGPLV3.txt" "LICENSE.AGPLV3.Clause11.txt" "CHANGELOG" DESTINATION .)
# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(SOFTROBOTSINVERSE_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(SOFTROBOTSINVERSE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
include(cmake/packaging.cmake)