forked from sofa-framework/BeamAdapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
175 lines (139 loc) · 7.19 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
cmake_minimum_required(VERSION 3.12)
project(BeamAdapter VERSION 1.0)
include(cmake/environment.cmake)
find_package(Sofa.Simulation.Core REQUIRED)
sofa_find_package(Sofa.Component.StateContainer REQUIRED)
sofa_find_package(Sofa.Component.Controller REQUIRED)
sofa_find_package(Sofa.Component.Topology.Container.Dynamic REQUIRED)
sofa_find_package(Sofa.Component.Topology.Mapping REQUIRED)
sofa_find_package(Sofa.Component.Collision.Geometry REQUIRED)
sofa_find_package(Sofa.Component.Constraint.Projective REQUIRED)
sofa_find_package(Sofa.Component.Constraint.Lagrangian REQUIRED)
sofa_find_package(SofaImplicitField QUIET)
sofa_find_package(SofaAdvancedConstraint QUIET)
sofa_find_package(SofaCUDA QUIET)
set(BEAMADAPTER_SRC "src/${PROJECT_NAME}")
set(HEADER_FILES
${BEAMADAPTER_SRC}/config.h.in
${BEAMADAPTER_SRC}/initBeamAdapter.h
${BEAMADAPTER_SRC}/component/BeamInterpolation.h
${BEAMADAPTER_SRC}/component/BeamInterpolation.inl
${BEAMADAPTER_SRC}/component/WireBeamInterpolation.h
${BEAMADAPTER_SRC}/component/WireBeamInterpolation.inl
${BEAMADAPTER_SRC}/component/constraint/AdaptiveBeamSlidingConstraint.h
${BEAMADAPTER_SRC}/component/constraint/AdaptiveBeamSlidingConstraint.inl
${BEAMADAPTER_SRC}/component/constraint/AdaptiveBeamLengthConstraint.h
${BEAMADAPTER_SRC}/component/constraint/AdaptiveBeamLengthConstraint.inl
${BEAMADAPTER_SRC}/component/controller/AdaptiveBeamController.h
${BEAMADAPTER_SRC}/component/controller/AdaptiveBeamController.inl
${BEAMADAPTER_SRC}/component/controller/InterventionalRadiologyController.h
${BEAMADAPTER_SRC}/component/controller/InterventionalRadiologyController.inl
${BEAMADAPTER_SRC}/component/controller/SutureController.h
${BEAMADAPTER_SRC}/component/controller/SutureController.inl
${BEAMADAPTER_SRC}/component/engine/WireRestShape.h
${BEAMADAPTER_SRC}/component/engine/WireRestShape.inl
${BEAMADAPTER_SRC}/component/engine/SteerableCatheter.h
${BEAMADAPTER_SRC}/component/engine/SteerableCatheter.inl
${BEAMADAPTER_SRC}/component/forcefield/AdaptiveBeamForceFieldAndMass.h
${BEAMADAPTER_SRC}/component/forcefield/AdaptiveBeamForceFieldAndMass.inl
${BEAMADAPTER_SRC}/component/forcefield/AdaptiveInflatableBeamForceField.h
${BEAMADAPTER_SRC}/component/forcefield/AdaptiveInflatableBeamForceField.inl
${BEAMADAPTER_SRC}/component/mapping/AdaptiveBeamMapping.h
${BEAMADAPTER_SRC}/component/mapping/AdaptiveBeamMapping.inl
${BEAMADAPTER_SRC}/component/mapping/MultiAdaptiveBeamMapping.h
${BEAMADAPTER_SRC}/component/mapping/MultiAdaptiveBeamMapping.inl
${BEAMADAPTER_SRC}/utils/BeamSection.h
${BEAMADAPTER_SRC}/utils/deprecatedcomponent.h
)
set(SOURCE_FILES
${BEAMADAPTER_SRC}/initBeamAdapter.cpp
${BEAMADAPTER_SRC}/component/BeamInterpolation.cpp
${BEAMADAPTER_SRC}/component/WireBeamInterpolation.cpp
${BEAMADAPTER_SRC}/component/constraint/AdaptiveBeamSlidingConstraint.cpp
${BEAMADAPTER_SRC}/component/constraint/AdaptiveBeamLengthConstraint.cpp
${BEAMADAPTER_SRC}/component/controller/AdaptiveBeamController.cpp
${BEAMADAPTER_SRC}/component/controller/InterventionalRadiologyController.cpp
${BEAMADAPTER_SRC}/component/controller/SutureController.cpp
${BEAMADAPTER_SRC}/component/engine/WireRestShape.cpp
${BEAMADAPTER_SRC}/component/engine/SteerableCatheter.cpp
${BEAMADAPTER_SRC}/component/forcefield/AdaptiveBeamForceFieldAndMass.cpp
${BEAMADAPTER_SRC}/component/forcefield/AdaptiveInflatableBeamForceField.cpp
${BEAMADAPTER_SRC}/component/mapping/AdaptiveBeamMapping.cpp
${BEAMADAPTER_SRC}/component/mapping/MultiAdaptiveBeamMapping.cpp
)
if(SofaImplicitField_FOUND)
set(HEADER_FILES ${HEADER_FILES}
${BEAMADAPTER_SRC}/component/constraint/ImplicitSurfaceAdaptiveConstraint.h
${BEAMADAPTER_SRC}/component/constraint/ImplicitSurfaceAdaptiveConstraint.inl
)
set(SOURCE_FILES ${SOURCE_FILES}
${BEAMADAPTER_SRC}/component/constraint/ImplicitSurfaceAdaptiveConstraint.cpp
)
endif()
if(SofaAdvancedConstraint_FOUND)
set(HEADER_FILES ${HEADER_FILES}
${BEAMADAPTER_SRC}/component/AdaptiveBeamContactMapper.h
${BEAMADAPTER_SRC}/component/AdaptiveBeamContactMapper.inl
# ${BEAMADAPTER_SRC}/component/AdaptiveBeamFrictionContact.h
# ${BEAMADAPTER_SRC}/component/AdaptiveBeamFrictionContact.inl
${BEAMADAPTER_SRC}/component/MultiAdaptiveBeamContactMapper.h
${BEAMADAPTER_SRC}/component/MultiAdaptiveBeamContactMapper.inl
)
set(SOURCE_FILES ${SOURCE_FILES}
${BEAMADAPTER_SRC}/component/AdaptiveBeamContactMapper.cpp
${BEAMADAPTER_SRC}/component/AdaptiveBeamFrictionContact.cpp
${BEAMADAPTER_SRC}/component/MultiAdaptiveBeamContactMapper.cpp
)
#find_package(CUDA REQUIRED)
#cuda_include_directories(${SOFA_CUDA_DIR})
#cuda_include_directories(${SOFA_FRAMEWORK_DIR})
#cuda_add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES})
endif()
if(SofaCUDA_FOUND)
list (APPEND SOURCE_FILES
${BEAMADAPTER_SRC}/gpu/cuda/CudaInstantiations.cpp
)
message(STATUS "BeamAdapter: SofaCUDA has been enabled, instantiations for CudaTypes will be enabled.")
endif()
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Core)
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.StateContainer Sofa.Component.Controller Sofa.Component.Topology.Container.Dynamic Sofa.Component.Topology.Mapping)
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.Collision.Geometry Sofa.Component.Constraint.Lagrangian Sofa.Component.Constraint.Projective)
if(SofaImplicitField_FOUND)
target_link_libraries(${PROJECT_NAME} PUBLIC SofaImplicitField)
endif()
if(SofaAdvancedConstraint_FOUND)
target_link_libraries(${PROJECT_NAME} PUBLIC SofaAdvancedConstraint)
endif()
if(SofaCUDA_FOUND)
target_link_libraries(${PROJECT_NAME} PUBLIC SofaCUDA)
endif()
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"
)
# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(BEAMADAPTER_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(BEAMADAPTER_BUILD_TESTS)
enable_testing()
add_subdirectory(${PROJECT_NAME}_test)
endif()
# this paragraph has not been ported to the new build system yet...
#if(SOFA-PLUGIN_SOFAADVANCEDCONSTRAINT)
#set(LINKER_DEPENDENCIES SofaAdvancedConstraint)
#list(APPEND LINKER_DEPENDENCIES SofaCUDA)
#list(APPEND LINKER_DEPENDENCIES SofaCUDADev)
#set(LINKER_DEPENDENCIES SofaAdvancedConstraint)
#endif()
# Organize projects into folders
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "plugins")
# Config files and install rules for pythons scripts
sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
include(cmake/packaging.cmake)