forked from sofa-framework/Optimus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
226 lines (203 loc) · 9.64 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
cmake_minimum_required(VERSION 3.11)
set(OPTIMUS_MAJOR_VERSION 1)
set(OPTIMUS_MINOR_VERSION 1)
set(OPTIMUS_VERSION ${OPTIMUS_MAJOR_VERSION}.${OPTIMUS_MINOR_VERSION})
project(Optimus VERSION ${OPTIMUS_VERSION})
# required standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(SofaFramework REQUIRED)
find_package(SofaSimulation REQUIRED)
find_package(SofaBase REQUIRED)
find_package(SofaGeneralAnimationLoop REQUIRED)
find_package(SofaGeneralEngine REQUIRED)
find_package(SofaImplicitOdeSolver REQUIRED)
find_package(SofaGeneralLinearSolver REQUIRED)
find_package(SofaGeneralRigid REQUIRED)
find_package(SofaSimpleFem REQUIRED)
find_package(SofaGeneralTopology REQUIRED)
find_package(SofaTopologyMapping REQUIRED)
find_package(SofaUserInteraction REQUIRED)
find_package(SofaConstraint REQUIRED)
find_package(SofaGeneralLoader REQUIRED)
find_package(SofaMiscEngine REQUIRED)
find_package(SofaMiscForceField REQUIRED)
find_package(SofaMiscMapping REQUIRED)
find_package(SofaMiscSolver REQUIRED)
find_package(SofaMiscTopology REQUIRED)
find_package(SofaMiscFem REQUIRED)
find_package(SofaExporter REQUIRED)
find_package(SofaGui REQUIRED)
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
# configuration flags
set(STOCHASTIC_FILTERING "1" CACHE BOOL "Set to activate the compilation of the filtering module" FORCE)
set(USE_BLAS_FOR_OPTIMUS "1" CACHE BOOL "Set to include BLAS in dependences")
include_directories(${EIGEN3_INCLUDE_DIR})
set(LINKER_DEPENDENCIES SofaCore SofaBase SofaGeneralAnimationLoop SofaGeneralEngine SofaImplicitOdeSolver SofaGeneralLinearSolver SofaGeneralRigid SofaBoundaryCondition SofaBaseTopology SofaExporter SofaUserInteraction SofaConstraint SofaSimpleFem SofaGeneralTopology SofaTopologyMapping SofaUserInteraction SofaConstraint SofaGeneralLoader SofaMiscEngine SofaMiscFem SofaMiscForceField SofaMiscMapping SofaMiscSolver SofaMiscTopology SofaGuiCommon Eigen3::Eigen)
if ( ${USE_BLAS_FOR_OPTIMUS} )
message(STATUS "Add blas dependency")
set(LINKER_DEPENDENCIES ${LINKER_DEPENDENCIES} blas)
endif()
if ( WIN32 )
set(COMPILATION_FLAGS "-DSOFA_BUILD_OPTIMUS")
else()
set(COMPILATION_FLAGS "-DSOFA_BUILD_OPTIMUS -Wno-deprecated") # obsolete flag: -Wno-unused-local-typedef
endif()
set(HEADER_FILES
src/optimusConfig.h
src/initOptimusPlugin.h
src/genericComponents/TimeProfiling.h
src/genericComponents/ShowSpheres.h
src/genericComponents/ShowSpheres.inl
src/genericComponents/OptimParams.h
src/genericComponents/OptimParams.inl
src/genericComponents/PointProjection.h
src/genericComponents/PointProjection.inl
src/genericComponents/ObservationSource.h
src/genericComponents/SimulatedStateObservationSource.h
src/genericComponents/SimulatedStateObservationSource.inl
src/genericComponents/SimulatedStateObservationStreamer.h
src/genericComponents/SimulatedStateObservationStreamer.inl
src/genericComponents/AddNoiseEngine.h
src/genericComponents/AddNoiseEngine.inl
src/genericComponents/CorrectionForceField.h
src/genericComponents/CorrectionForceField.inl
src/genericComponents/TransformStochasticEngine.h
src/genericComponents/TransformStochasticEngine.inl
src/genericComponents/FilteringUpdateEngine.h
src/genericComponents/FilteringUpdateEngine.inl
src/genericComponents/StochasticPositionHandler.h
src/genericComponents/StochasticPositionHandler.inl
src/genericComponents/FilterEvents.h
src/genericComponents/VTKExporterDA.h
src/genericComponents/SigmaPointsVTKExporter.h
src/genericComponents/OptimMonitor.h
src/genericComponents/OptimMonitor.inl
src/genericComponents/Indices2ValuesTransformer.h
src/genericComponents/Indices2ValuesTransformer.inl
src/genericComponents/StepPCGLinearSolver.h
src/genericComponents/MatrixCovariance.h
src/genericComponents/MatrixCovariance.inl
src/test/GeoEmulator.h
src/test/GeoEmulator.inl
src/test/GeoListener.h
src/test/GeoListener.inl
)
set(SOURCE_FILES
src/initOptimusPlugin.cpp
src/genericComponents/ShowSpheres.cpp
src/genericComponents/OptimParams.cpp
src/genericComponents/PointProjection.cpp
src/genericComponents/SimulatedStateObservationSource.cpp
src/genericComponents/SimulatedStateObservationStreamer.cpp
src/genericComponents/AddNoiseEngine.cpp
src/genericComponents/CorrectionForceField.cpp
src/genericComponents/TransformStochasticEngine.cpp
src/genericComponents/FilteringUpdateEngine.cpp
src/genericComponents/StochasticPositionHandler.cpp
src/genericComponents/FilterEvents.cpp
src/genericComponents/VTKExporterDA.cpp
src/genericComponents/SigmaPointsVTKExporter.cpp
src/genericComponents/OptimMonitor.cpp
src/genericComponents/Indices2ValuesTransformer.cpp
src/genericComponents/StepPCGLinearSolver.cpp
src/genericComponents/MatrixCovariance.cpp
src/test/GeoEmulator.cpp
src/test/GeoListener.cpp
)
set(README_FILES ReadMe.md)
if ( ${STOCHASTIC_FILTERING} )
message(STATUS "Activating stochastic filtering")
list(APPEND HEADER_FILES
src/stochasticFiltering/FilteringAnimationLoop.h
src/stochasticFiltering/StochasticFilterBase.h
src/stochasticFiltering/ROUKFilter.h
src/stochasticFiltering/ROUKFilter.inl
src/stochasticFiltering/UKFilterSimCorr.h
src/stochasticFiltering/UKFilterSimCorr.inl
src/stochasticFiltering/UKFilterClassic.h
src/stochasticFiltering/UKFilterClassic.inl
src/stochasticFiltering/ETKFilter.h
src/stochasticFiltering/ETKFilter.inl
src/stochasticFiltering/UKFilterClassicWithSVD.h
src/stochasticFiltering/UKFilterClassicWithSVD.inl
src/stochasticFiltering/AdaptativeUKFilterClassic.h
src/stochasticFiltering/AdaptativeUKFilterClassic.inl
src/stochasticFiltering/StochasticStateWrapperBase.h
src/stochasticFiltering/StochasticStateWrapper.h
src/stochasticFiltering/StochasticStateWrapper.inl
src/stochasticFiltering/ObservationManagerBase.h
src/stochasticFiltering/MappedStateObservationManager.h
src/stochasticFiltering/MappedStateObservationManager.inl
src/stochasticFiltering/MappedStateVelocityObservationManager.h
src/stochasticFiltering/MappedStateVelocityObservationManager.inl
src/stochasticFiltering/SimpleObservationManager.h
src/stochasticFiltering/SimpleObservationManager.inl
src/stochasticFiltering/SimpleUncorrespondentObservationManager.h
src/stochasticFiltering/SimpleUncorrespondentObservationManager.inl
src/stochasticFiltering/BindedSimpleObservationManager.h
src/stochasticFiltering/BindedSimpleObservationManager.inl
src/stochasticFiltering/PreStochasticWrapper.h
src/stochasticFiltering/ForceFieldSensitivity.h
)
list(APPEND SOURCE_FILES
src/stochasticFiltering/FilteringAnimationLoop.cpp
src/stochasticFiltering/ROUKFilter.cpp
src/stochasticFiltering/UKFilterSimCorr.cpp
src/stochasticFiltering/UKFilterClassic.cpp
src/stochasticFiltering/ETKFilter.cpp
src/stochasticFiltering/UKFilterClassicWithSVD.cpp
src/stochasticFiltering/AdaptativeUKFilterClassic.cpp
src/stochasticFiltering/StochasticStateWrapper.cpp
src/stochasticFiltering/MappedStateObservationManager.cpp
src/stochasticFiltering/MappedStateVelocityObservationManager.cpp
src/stochasticFiltering/SimpleObservationManager.cpp
src/stochasticFiltering/SimpleUncorrespondentObservationManager.cpp
src/stochasticFiltering/BindedSimpleObservationManager.cpp
src/stochasticFiltering/PreStochasticWrapper.cpp
)
endif()
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})
if(SofaPardisoSolver_FOUND)
set(LINKER_DEPENDENCIES ${LINKER_DEPENDENCIES} SofaPardisoSolver)
else()
message("SofaPardisoSolver not found, PardisoSolver component will not work")
endif()
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${OPTIMUS_VERSION}")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${COMPILATION_FLAGS}")
if ( ${USE_BLAS_FOR_OPTIMUS} )
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS "BLAS_LINKED")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADER_FILES}")
target_link_libraries(${PROJECT_NAME} ${LINKER_DEPENDENCIES})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
get_target_property(compile_defs ${PROJECT_NAME} COMPILE_FLAGS)
message(STATUS "Compile definitions: ${compile_defs}")
# install rules
if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
endif()
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
#sofa_create_package(
# PACKAGE_NAME ${PROJECT_NAME}
# PACKAGE_VERSION ${PROJECT_VERSION}
# RELOCATABLE "plugins"
# )
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}
EXAMPLE_INSTALL_DIR "examples"
RELOCATABLE "plugins"
)
#install(TARGETS Optimus
# EXPORT OptimusTargets
# RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# PUBLIC_HEADER DESTINATION include/Optimus)