CMakeLists.txt 8.9 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
project(AMDiS)

set(BASE_DIR ${AMDiS_SOURCE_DIR})
set(SOURCE_DIR ${BASE_DIR}/src)
list(APPEND CMAKE_MODULE_PATH ${BASE_DIR}/cmake)

if (NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Release")
endif ()

12
13
14
15
16
17
18
19
20
21
22
# Include macros
include(enable_cxx11)
include(enable_mtl4)
include(enable_boost)
include(enable_umfpack)
include(enable_petsc)
include(enable_zoltan)
include(enable_bddcml)
include(enable_hypre)
include(enable_png)

23
24
25
26
27
28
# ------------------------------------------------------------------------------

#some options to control the build process
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition" false)
option(ENABLE_UMFPACK "Enable support for the UMFPACK solver" true)
option(ENABLE_EXTENSIONS "Use extensions for AMDiS" false)
29
30
31
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
option(ENABLE_PNG "Use png reader/writer" false)
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
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

# enable/disable some more features
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true)
mark_as_advanced(ENABLE_COMPRESSION)

option(ENABLE_REINIT "Compile reinit library" true)
mark_as_advanced(ENABLE_REINIT)

option(ENABLE_COMPOSITE_FEM "Compile compositeFEM library" true)
mark_as_advanced(ENABLE_COMPOSITE_FEM)

option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true)
mark_as_advanced(BUILD_SHARED_LIBS)

if (MSVC)
  set(BUILD_SHARED_LIBS false)
  mark_as_advanced(BUILD_SHARED_LIBS)
  message(WARNING "Currently we can only build static libraries with Visual Studio")
endif (MSVC)

# ------------------------------------------------------------------------------

include_directories(${SOURCE_DIR})
set(AMDIS_INCLUDE_DIRS "")
set(COMPILEFLAGS "")

enable_cxx11(ENABLE_CXX11 COMPILEFLAGS)
if (ENABLE_CXX11)
  list(APPEND COMPILEFLAGS "-DHAS_CXX11=1")
else ()
  list(APPEND COMPILEFLAGS "-DHAS_CXX11=0")
endif (ENABLE_CXX11)

65
66
enable_mtl4(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
enable_boost(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
67
68
69
70
71

if (ENABLE_UMFPACK)
  enable_umfpack(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
endif (ENABLE_UMFPACK)

72
73
74
if (ENABLE_PNG)
  enable_png(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
endif (ENABLE_PNG)
75
76
77

# ------------------------------------------------------------------------------

78
set(AMDIS_SRC "")
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
list(APPEND AMDIS_SRC
    ${SOURCE_DIR}/AdaptBase.cc
    ${SOURCE_DIR}/AdaptInfo.cc
    ${SOURCE_DIR}/AdaptInstationary.cc
    ${SOURCE_DIR}/AdaptStationary.cc
    ${SOURCE_DIR}/AMDiS.cc
    ${SOURCE_DIR}/Assembler.cc
    ${SOURCE_DIR}/BasisFunction.cc
    ${SOURCE_DIR}/Boundary.cc
    ${SOURCE_DIR}/BoundaryManager.cc
    ${SOURCE_DIR}/BoundaryObject.cc
    ${SOURCE_DIR}/Bubble.cc
    ${SOURCE_DIR}/Cholesky.cc
    ${SOURCE_DIR}/CoarseningManager.cc
    ${SOURCE_DIR}/CoarseningManager1d.cc
    ${SOURCE_DIR}/CoarseningManager2d.cc
    ${SOURCE_DIR}/CoarseningManager3d.cc
    ${SOURCE_DIR}/ComponentTraverseInfo.cc
    ${SOURCE_DIR}/CouplingIterationInterface.cc
    ${SOURCE_DIR}/CreatorMap.cc
    ${SOURCE_DIR}/DOFAdmin.cc
    ${SOURCE_DIR}/DOFIndexed.cc
    ${SOURCE_DIR}/DOFMatrix.cc
    ${SOURCE_DIR}/DOFVector.cc
    ${SOURCE_DIR}/DirichletBC.cc
    ${SOURCE_DIR}/DualTraverse.cc
    ${SOURCE_DIR}/ElInfo.cc
    ${SOURCE_DIR}/ElInfo1d.cc
    ${SOURCE_DIR}/ElInfo2d.cc
    ${SOURCE_DIR}/ElInfo3d.cc
    ${SOURCE_DIR}/ElInfoStack.cc
    ${SOURCE_DIR}/Element.cc
    ${SOURCE_DIR}/ElementData.cc
    ${SOURCE_DIR}/ElementDofIterator.cc
    ${SOURCE_DIR}/ElementRegion_ED.cc
    ${SOURCE_DIR}/FiniteElemSpace.cc
    ${SOURCE_DIR}/FirstOrderAssembler.cc
    ${SOURCE_DIR}/FirstOrderTerm.cc
    ${SOURCE_DIR}/FixVec.cc
    ${SOURCE_DIR}/Global.cc
    ${SOURCE_DIR}/Initfile.cc
    ${SOURCE_DIR}/Lagrange.cc
    ${SOURCE_DIR}/LeafData.cc
    ${SOURCE_DIR}/Line.cc
    ${SOURCE_DIR}/MacroElement.cc
    ${SOURCE_DIR}/Marker.cc
    ${SOURCE_DIR}/MatrixVector.cc
    ${SOURCE_DIR}/Mesh.cc
    ${SOURCE_DIR}/MeshStructure.cc
    ${SOURCE_DIR}/Operator.cc
    ${SOURCE_DIR}/OperatorTerm.cc
    ${SOURCE_DIR}/Parametric.cc
    ${SOURCE_DIR}/PeriodicBC.cc
    ${SOURCE_DIR}/ProblemInstat.cc
    ${SOURCE_DIR}/ProblemInterpol.cc
    ${SOURCE_DIR}/ProblemStat.cc
    ${SOURCE_DIR}/Projection.cc
    ${SOURCE_DIR}/QPInfo.cc
    ${SOURCE_DIR}/QPsiPhi.cc
    ${SOURCE_DIR}/Quadrature.cc
    ${SOURCE_DIR}/RCNeighbourList.cc
    ${SOURCE_DIR}/Recovery.cc
    ${SOURCE_DIR}/RefinementManager.cc
    ${SOURCE_DIR}/RefinementManager1d.cc
    ${SOURCE_DIR}/RefinementManager2d.cc
    ${SOURCE_DIR}/RefinementManager3d.cc
    ${SOURCE_DIR}/RobinBC.cc
    ${SOURCE_DIR}/ScalableQuadrature.cc
    ${SOURCE_DIR}/SecondOrderAssembler.cc
    ${SOURCE_DIR}/SecondOrderTerm.cc
    ${SOURCE_DIR}/Serializer.cc
    ${SOURCE_DIR}/StandardProblemIteration.cc
    ${SOURCE_DIR}/SubAssembler.cc
    ${SOURCE_DIR}/SubElInfo.cc
    ${SOURCE_DIR}/SubQuadrature.cc
    ${SOURCE_DIR}/SurfaceQuadrature.cc
    ${SOURCE_DIR}/SurfaceRegion_ED.cc
    ${SOURCE_DIR}/SystemVector.cc
    ${SOURCE_DIR}/Tetrahedron.cc
    ${SOURCE_DIR}/Timer.cc
    ${SOURCE_DIR}/Traverse.cc
    ${SOURCE_DIR}/Triangle.cc
    ${SOURCE_DIR}/VertexVector.cc
    ${SOURCE_DIR}/ZeroOrderAssembler.cc
    ${SOURCE_DIR}/ZeroOrderTerm.cc
    ${SOURCE_DIR}/est/Estimator.cc
    ${SOURCE_DIR}/est/RecoveryEstimator.cc
    ${SOURCE_DIR}/est/ResidualEstimator.cc
    ${SOURCE_DIR}/est/SimpleResidualEstimator.cc
    ${SOURCE_DIR}/io/ArhReader.cc
    ${SOURCE_DIR}/io/detail/ArhReader.cc
    ${SOURCE_DIR}/io/Arh2Reader.cc
    ${SOURCE_DIR}/io/Arh2Writer.cc
    ${SOURCE_DIR}/io/Arh3Reader.cc
    ${SOURCE_DIR}/io/Arh3Writer.cc
    ${SOURCE_DIR}/io/detail/Arh2Reader.cc
    ${SOURCE_DIR}/io/detail/ArhWriter.cc
    ${SOURCE_DIR}/io/detail/Arh2Writer.cc
    ${SOURCE_DIR}/io/detail/Arh3Reader.cc
    ${SOURCE_DIR}/io/detail/Arh3Writer.cc
    ${SOURCE_DIR}/io/DofWriter.cc
    ${SOURCE_DIR}/io/ElementFileWriter.cc
    ${SOURCE_DIR}/io/FileWriterInterface.cc
    ${SOURCE_DIR}/io/FileWriter.cc
    ${SOURCE_DIR}/io/GNUPlotWriter.cc
    ${SOURCE_DIR}/io/MacroInfo.cc
    ${SOURCE_DIR}/io/MacroReader.cc
    ${SOURCE_DIR}/io/MacroWriter.cc
    ${SOURCE_DIR}/io/PngReader.cc
    ${SOURCE_DIR}/io/PngWriter.cc
    ${SOURCE_DIR}/io/PovrayWriter.cc
    ${SOURCE_DIR}/io/Spreadsheet.cc
    ${SOURCE_DIR}/io/ValueReader.cc
    ${SOURCE_DIR}/io/ValueWriter.cc
    ${SOURCE_DIR}/io/VtkWriter.cc
    ${SOURCE_DIR}/io/VtkVectorWriter.cc
    ${SOURCE_DIR}/io/detail/VtkWriter.cc
    ${SOURCE_DIR}/nonlin/ProblemNonLin.cc
    ${SOURCE_DIR}/solver/SolverMatrix.cc
    ${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
    ${SOURCE_DIR}/time/RosenbrockMethod.cc
    ${SOURCE_DIR}/time/RosenbrockStationary.cc
# debugging files
    ${SOURCE_DIR}/Debug.cc
    ${SOURCE_DIR}/GlobalDOFNumbering.cc      # not used by any other class
    ${SOURCE_DIR}/GlobalElementNumbering.cc  # not used by any other class
    ${SOURCE_DIR}/ProblemStatDbg.cc
)

208
include(amdis_parallel)
209
210
211
212
include(amdis_extensions)
include(muparser)

# ------------------------------------------------------------------------------
213
214
215
216
217
if (ENABLE_PARALLEL_DOMAIN)
  set(POSTFIX "-parallel")
else ()
  set(POSTFIX "")
endif (ENABLE_PARALLEL_DOMAIN)
218
219
220
221
222
223
224
225
226
227
228
229
230

if (ENABLE_COMPRESSION)
  list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1")
endif (ENABLE_COMPRESSION)

if (ENABLE_REINIT)
  include(amdis_reinit)
endif (ENABLE_REINIT)

if (ENABLE_COMPOSITE_FEM)
  include(amdis_compositeFEM)
endif (ENABLE_COMPOSITE_FEM)

231
232
233
if (ENABLE_SEQ_PETSC)
  include(amdis_seq_petsc)
endif (ENABLE_SEQ_PETSC)
234
235
236
237
238

if (MSVC)
  list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS")
endif (MSVC)

239
240
241
242
243
244
245
246
247
248
# ------------------------------------------------------------------------------

include_directories(${AMDIS_INCLUDE_DIRS})
add_definitions(${COMPILEFLAGS})

add_library(amdis${POSTFIX} ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC} ${EXTENSIONS_SRC})
add_library(amdis${POSTFIX}_compositeFEM ${COMPOSITE_FEM_SRC})
add_library(amdis${POSTFIX}_reinit ${REINIT_SRC})


249
250
251
# specify how to install this target:
# -----------------------------------
set(INSTALL_SUBDIRS . config nonlin est expressions operations traits
252
                      utility time solver solver/details solver/itl io io/detail)
253
254

foreach (SUBDIR ${INSTALL_SUBDIRS})
255
256
  file(GLOB HEADERS "${SOURCE_DIR}/${SUBDIR}/*.h*")
  install(FILES ${HEADERS} DESTINATION include/amdis/${SUBDIR}/)
257
258
endforeach ()

259
260
261
262
263
264
265
266
267
file(GLOB CMAKE_MACROS "${BASE_DIR}/cmake/enable_*.cmake")
install(FILES ${CMAKE_MACROS} DESTINATION share/amdis/)

install(DIRECTORY ${BASE_DIR}/lib/mtl4/ DESTINATION include/amdis/mtl4/
  FILES_MATCHING PATTERN "*.hpp"
  PATTERN ".svn" EXCLUDE
  PATTERN ".svn/*" EXCLUDE
  PATTERN "mtl4/libs" EXCLUDE
  PATTERN "mtl4/extern" EXCLUDE)
268

269
270
271
272
273
install(TARGETS
  amdis${POSTFIX}
  amdis${POSTFIX}_compositeFEM
  amdis${POSTFIX}_reinit
  DESTINATION lib/amdis/ )
274
275


276
277
278
# generate configuration file:
# ----------------------------
configure_file(${BASE_DIR}/cmake/AMDISConfig.cmake.in
279
280
  ${AMDiS_BINARY_DIR}/AMDISConfig.cmake
  @ONLY
281
)
282

283
284
install(FILES ${AMDiS_BINARY_DIR}/AMDISConfig.cmake DESTINATION share/amdis/)
install(FILES ${BASE_DIR}/cmake/AMDISUse.cmake DESTINATION share/amdis/)