CMakeLists.txt 20.7 KB
Newer Older
1
project(AMDIS)
Naumann, Andreas's avatar
Naumann, Andreas committed
2

3
cmake_minimum_required(VERSION 2.6)
4
cmake_policy(SET CMP0017 OLD)
Naumann, Andreas's avatar
Naumann, Andreas committed
5
6
7
if(POLICY CMP0042)
	cmake_policy(SET CMP0042 NEW)
endif()
8
9
10
11
if(POLICY CMP0054)
	cmake_policy(SET CMP0054 NEW)
endif()

12
13
SET(LIB_DIR ${AMDIS_SOURCE_DIR}/lib)
SET(SOURCE_DIR ${AMDIS_SOURCE_DIR}/src)
14

15
#TODO: use the cmake build type
16
SET(MTL_INCLUDE_DIR ${LIB_DIR}/mtl4/ CACHE PATH "mtl4 directory")
17

18
19
20
21
22
# set global compile_definitions for all target, depending on build-type
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
    $<$<CONFIG:Debug>:DEBUG=1>
    $<$<CONFIG:Release>:DEBUG=0>)

Praetorius, Simon's avatar
Praetorius, Simon committed
23
24
25
26
27
28
# find_package(Subversion QUIET)
# if(Subversion_FOUND)
#   Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} svn_info)
#   #message("svn-rev: ${svn_info_WC_REVISION}")
#   set(AMDIS_SUB_MINOR "${svn_info_WC_REVISION}")
# endif()
29
set(CurrentRevision "0.9")
30
31
32
33
34
35
if(NOT AMDIS_MAJOR)
  set(AMDIS_MAJOR "0")
endif()
if(NOT AMDIS_MINOR)
  set(AMDIS_MINOR "9")
endif()
36
list(APPEND COMPILEFLAGS "-DAMDIS_VERSION=${CurrentRevision}")
37
38
39
40
41
42

#define the build type, empty can be everything and nothing
if(CMAKE_BUILD_TYPE STREQUAL "")
	set(CMAKE_BUILD_TYPE "Release")
endif()

43
44
if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
	Message("Compiler: Intel")
45
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable 654 -diag-disable 858")
46
47
endif()

Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
48

49
SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" )
Praetorius, Simon's avatar
Praetorius, Simon committed
50
option(ENABLE_CXX11 "Enable C++11 compiler features" false)
51
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
52
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
53
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
Praetorius, Simon's avatar
Praetorius, Simon committed
54
option(ENABLE_PNG "use png reader/writer" false)
55
option(ENABLE_BDDCML "Use of BDDCML library" false)
56
mark_as_advanced(ENABLE_BDDCML)
57
option(ENABLE_EXTENSIONS "Use extensions" false)
Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
58
option(ENABLE_OPENMP "Use OpenMP" false)
59
option(ENABLE_COMPRESSION "Use output compression" false)
60
option(ENABLE_OUTPUT "AMDiS output printing, disable only for debugging!" true)
Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
61
62
mark_as_advanced(ENABLE_OUTPUT)

Naumann, Andreas's avatar
Naumann, Andreas committed
63

64
find_package(Boost 1.44 REQUIRED)
65
if (Boost_FOUND)
66
  list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
67
68
  message("boost lib-dirs: ${Boost_LIBRARY_DIRS}")
  message("use the boost dir: ${Boost_INCLUDE_DIR}")
69
70
71
72
  #if (WIN32)
	#message("the windows find_boost does not set the boost library paths, please set it")
	#SET(Boost_LIBRARY_DIRS CACHE PATH "The directory containing the boost libraries")
  #endif (WIN32)
73
  list(APPEND AMDIS_LINK_DIRS ${Boost_LIBRARY_DIRS})
74
endif (Boost_FOUND)
Naumann, Andreas's avatar
Naumann, Andreas committed
75

76

Thomas Witkowski's avatar
Thomas Witkowski committed
77
SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
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
            ${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}/Debug.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}/GlobalDOFNumbering.cc
            ${SOURCE_DIR}/GlobalElementNumbering.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}/ProblemStatDbg.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
Naumann, Andreas's avatar
Naumann, Andreas committed
202
	      )
203
204
205
206
207
208
209
210
211
212
213


include(cmake/enable_cxx11.cmake)
include(cmake/enable_parallel_domain.cmake)
include(cmake/enable_seq_petsc.cmake)
include(cmake/enable_umfpack.cmake)
include(cmake/enable_hypre.cmake)
include(cmake/enable_png.cmake)
include(cmake/enable_bddcml.cmake)
include(cmake/enable_extensions.cmake)
include(cmake/enable_openmp.cmake)
Naumann, Andreas's avatar
Naumann, Andreas committed
214

215
if(ENABLE_COMPRESSION)
216
    list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1")
217
endif(ENABLE_COMPRESSION)
218

Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
219
if(NOT ENABLE_OUTPUT)
220
221
    message(WARNING "AMDiS cout output disabled!")
    list(APPEND COMPILEFLAGS "-DSUPPRESS_OUTPUT")
Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
222
223
endif(NOT ENABLE_OUTPUT)

224
225
226
if(ENABLE_MARMOT)
	Message("please set marmotcc manually")
endif(ENABLE_MARMOT)
Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
227
228


229
# composite fem includes
230
SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM)
231
232
233
234
235
236
237
238
SET(COMPOSITE_FEM_SRC ${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc
		      ${COMPOSITE_SOURCE_DIR}/CFE_NormAndErrorFcts.cc
		      ${COMPOSITE_SOURCE_DIR}/CompositeFEMMethods.cc
		      ${COMPOSITE_SOURCE_DIR}/CompositeFEMOperator.cc
		      ${COMPOSITE_SOURCE_DIR}/LevelSetAdaptMesh.cc
		      ${COMPOSITE_SOURCE_DIR}/PenaltyOperator.cc
		      ${COMPOSITE_SOURCE_DIR}/ElementLevelSet.cc
		      ${COMPOSITE_SOURCE_DIR}/SubPolytope.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
239
240
		      ${COMPOSITE_SOURCE_DIR}/SubElementAssembler.cc )

241
# reinit includes
242
243
set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit)
file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc)
244
list(APPEND AMDIS_INCLUDE_DIRS ${REINIT_SOURCE_DIR})
245

246
# muparser includes
247
set(MUPARSER_SOURCE_DIR ${AMDIS_SOURCE_DIR}/lib/muparser_v134)
248
file(GLOB MUPARSER_SRC ${MUPARSER_SOURCE_DIR}/src/*.cpp)
249
list(APPEND AMDIS_INCLUDE_DIRS ${MUPARSER_SOURCE_DIR}/include)
250

251
# mtl4 includes
252
253
list(APPEND AMDIS_INCLUDE_DIRS ${MTL_INCLUDE_DIR})
list(APPEND AMDIS_INCLUDE_DIRS ${SOURCE_DIR})
254

255

256
include_directories(${AMDIS_INCLUDE_DIRS})
Naumann, Andreas's avatar
Naumann, Andreas committed
257

Praetorius, Simon's avatar
Praetorius, Simon committed
258
259
260
261
262
263
264
265
266
267
268
if(WIN32)
  add_library(amdis STATIC ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC})
  add_library(compositeFEM STATIC ${COMPOSITE_FEM_SRC})
  add_library(reinit STATIC ${REINIT_SRC})
  add_library(muparser STATIC ${MUPARSER_SRC})
else()
  add_library(amdis SHARED ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC})
  add_library(compositeFEM SHARED ${COMPOSITE_FEM_SRC})
  add_library(reinit SHARED ${REINIT_SRC})
  add_library(muparser SHARED ${MUPARSER_SRC})
endif()
269

270
271
272
273
274
275
276
277

if (${CMAKE_VERSION} VERSION_GREATER "3.0")
  foreach(feature in ${REQUIRED_CXX_FEATURES})
    target_compile_features(amdis INTERFACE feature)
    target_compile_features(muparser INTERFACE feature)
  endforeach(feature)
endif ()

278
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
279

280
281
# some special treatements for Windows systems
# --------------------------------------------
282
if(WIN32)
283
	list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS")
284
endif(WIN32)
285

286
287
# some special treatements for MacOS Systems
# ------------------------------------------
288
289
290
291
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
  if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
     SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup")
     SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup")
292

293
294
295
296
297
     set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -bind_at_load -m64")
     set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -bind_at_load -m64")
  endif()
endif()

298

299
message("compileflags: ${COMPILEFLAGS}")
300
add_definitions(${COMPILEFLAGS})
301

302
#dont change this destination. the GUI depends on it to guess the buildsystem
303

304
FILE(GLOB HEADERS "${SOURCE_DIR}/*.h")
305
INSTALL(FILES ${HEADERS}
306
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
307
308
list(APPEND deb_add_dirs "include/amdis")

309
FILE(GLOB HEADERS "${SOURCE_DIR}/config/*.h*")
310
INSTALL(FILES ${HEADERS}
311
312
313
	DESTINATION include/amdis/config/)
list(APPEND deb_add_dirs "include/amdis/config")

314
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
315
INSTALL(FILES ${HEADERS}
316
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
317

318
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hpp")
319
INSTALL(FILES ${HEADERS}
320
321
	DESTINATION include/amdis/)

322
FILE(GLOB HEADERS "${SOURCE_DIR}/parallel/*.h")
323
INSTALL(FILES ${HEADERS}
324
	DESTINATION include/amdis/parallel/)
Naumann, Andreas's avatar
Naumann, Andreas committed
325
326
list(APPEND deb_add_dirs "include/amdis/parallel")

327
FILE(GLOB HEADERS "${SOURCE_DIR}/nonlin/*.h")
328
INSTALL(FILES ${HEADERS}
329
330
331
	DESTINATION include/amdis/nonlin/)
list(APPEND deb_add_dirs "include/amdis/nonlin")

332
FILE(GLOB HEADERS "${SOURCE_DIR}/est/*.h")
333
INSTALL(FILES ${HEADERS}
334
335
336
	DESTINATION include/amdis/est/)
list(APPEND deb_add_dirs "include/amdis/est")

337
FILE(GLOB HEADERS "${SOURCE_DIR}/expressions/*.h*")
338
INSTALL(FILES ${HEADERS}
339
340
341
	DESTINATION include/amdis/expressions/)
list(APPEND deb_add_dirs "include/amdis/expressions")

342
FILE(GLOB HEADERS "${SOURCE_DIR}/operations/*.h*")
343
INSTALL(FILES ${HEADERS}
344
345
346
347
	DESTINATION include/amdis/operations/)
list(APPEND deb_add_dirs "include/amdis/operations")

FILE(GLOB HEADERS "${SOURCE_DIR}/traits/*.h*")
348
INSTALL(FILES ${HEADERS}
349
350
351
	DESTINATION include/amdis/traits/)
list(APPEND deb_add_dirs "include/amdis/traits")

Praetorius, Simon's avatar
Praetorius, Simon committed
352
FILE(GLOB HEADERS "${SOURCE_DIR}/utility/*.h*")
353
INSTALL(FILES ${HEADERS}
Praetorius, Simon's avatar
Praetorius, Simon committed
354
355
356
	DESTINATION include/amdis/utility/)
list(APPEND deb_add_dirs "include/amdis/utility")

357
FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h")
358
INSTALL(FILES ${HEADERS}
359
	DESTINATION include/amdis/time/)
Naumann, Andreas's avatar
Naumann, Andreas committed
360
361
list(APPEND deb_add_dirs "include/amdis/time")

362
FILE(GLOB HEADERS "${SOURCE_DIR}/traits/*.h*")
363
INSTALL(FILES ${HEADERS}
364
365
366
	DESTINATION include/amdis/traits/)
list(APPEND deb_add_dirs "include/amdis/traits")

367
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.h")
368
INSTALL(FILES ${HEADERS}
369
370
371
372
	DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")

FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.hh")
373
INSTALL(FILES ${HEADERS}
374
375
376
	DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")

Siqi Ling's avatar
Siqi Ling committed
377
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h")
378
INSTALL(FILES ${HEADERS}
Siqi Ling's avatar
Siqi Ling committed
379
380
381
        DESTINATION include/amdis/solver/details)
list(APPEND deb_add_dirs "include/amdis/solver/details")

382
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/itl/*.hpp")
383
INSTALL(FILES ${HEADERS}
384
385
	DESTINATION include/amdis/solver/itl)
list(APPEND deb_add_dirs "include/amdis/solver/itl")
Naumann, Andreas's avatar
Naumann, Andreas committed
386

387
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h")
388
INSTALL(FILES ${HEADERS}
389
390
391
392
	DESTINATION include/amdis/solver/details)
list(APPEND deb_add_dirs "include/amdis/solver/details")


393
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h")
Naumann, Andreas's avatar
Naumann, Andreas committed
394
395
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
Naumann, Andreas's avatar
Naumann, Andreas committed
396
397
list(APPEND deb_add_dirs "include/amdis/io")

398
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
Naumann, Andreas's avatar
Naumann, Andreas committed
399
400
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
401

402
403
404
FILE(GLOB HEADERS "${SOURCE_DIR}/io/detail/*h")
INSTALL(FILES ${HEADERS}
        DESTINATION include/amdis/io/detail)
405
list(APPEND deb_add_dirs "include/amdis/io/detail")
406

Praetorius, Simon's avatar
Praetorius, Simon committed
407
408
409
410
411
412
413
414
415
416
FILE(GLOB HEADERS "${REINIT_SOURCE_DIR}/*.h")
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/reinit)
list(APPEND deb_add_dirs "include/amdis/reinit")

FILE(GLOB HEADERS "${COMPOSITE_SOURCE_DIR}/*.h")
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/compositeFEM)
list(APPEND deb_add_dirs "include/amdis/compositeFEM")

417
418
419
420
421
FILE(GLOB HEADERS "${MUPARSER_SOURCE_DIR}/include/*.h")
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/muparser)
list(APPEND deb_add_dirs "include/amdis/muparser")

Praetorius, Simon's avatar
Praetorius, Simon committed
422
list(APPEND deb_add_dirs "lib/amdis")
423
install(TARGETS amdis compositeFEM reinit muparser
Praetorius, Simon's avatar
Praetorius, Simon committed
424
	DESTINATION lib/amdis/ )
Praetorius, Simon's avatar
Praetorius, Simon committed
425

426
configure_file(${AMDIS_SOURCE_DIR}/cmake/AMDISConfig.cmake.in
427
		${AMDIS_BINARY_DIR}/AMDISConfig.cmake
428
429
		@ONLY
	      )
430

431
INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake
432
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
433
434
list(APPEND deb_add_dirs "share/amdis/")

435
FILE(GLOB CMAKE_FILES "${AMDIS_SOURCE_DIR}/cmake/*.cmake")
436
INSTALL(FILES ${CMAKE_FILES}
437
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
438

439
#install mtl
440
INSTALL(DIRECTORY ${AMDIS_SOURCE_DIR}/lib/mtl4/
441
442
443
444
445
446
	DESTINATION include/amdis/mtl4/
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ".svn" EXCLUDE
	PATTERN ".svn/*" EXCLUDE
	PATTERN "mtl4/libs" EXCLUDE
	PATTERN "mtl4/extern" EXCLUDE
447
       )
448
449
FILE(GLOB_RECURSE mtl4_files
		RELATIVE ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/
450
		${AMDIS_SOURCE_DIR}/lib/mtl4/boost/*.hpp)
Naumann, Andreas's avatar
Naumann, Andreas committed
451
foreach(mtl4_file in ${mtl4_files})
452
453
    get_filename_component(mtl4File_path ${mtl4_file} PATH)
    list(APPEND deb_add_dirs "include/amdis/mtl4/boost/${mtl4File_path}")
Naumann, Andreas's avatar
Naumann, Andreas committed
454
endforeach(mtl4_file)
455
456
457
458
459
460

#install documentation
FILE(GLOB DOCS "${AMDIS_SOURCE_DIR}/doc/*.pdf")
INSTALL(FILES  ${DOCS} DESTINATION share/amdis/doc)
list(APPEND deb_add_dirs "share/amdis/doc")

Naumann, Andreas's avatar
Naumann, Andreas committed
461
list(REMOVE_DUPLICATES deb_add_dirs)
462

Praetorius, Simon's avatar
Praetorius, Simon committed
463
464
ENABLE_TESTING()
INCLUDE(CTest)
465
466
467
INCLUDE(Dart)
if(NOT CTEST_MODEL)
        set(CTEST_MODEL "Experimental")
Praetorius, Simon's avatar
Praetorius, Simon committed
468
endif()
469
if( NOT N_TEST_PROC)
470
	set(N_TEST_PROC "8")
Praetorius, Simon's avatar
Praetorius, Simon committed
471
endif()
472
473
configure_file(cmake/myMake.sh.in myMake.sh @ONLY)
configure_file(cmake/CTestScript.cmake.in CTestScript.cmake @ONLY)
Praetorius, Simon's avatar
Praetorius, Simon committed
474
475


476
477
# PACKAGES
# ========================================================
478
set(CPACK_PACKAGE_NAME "AMDIS")
479
set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de")
480
set(CPACK_PACKAGE_VERSION "${CurrentRevision}")
481
482
set(CPACK_GENERATOR "RPM" "DEB" "TGZ")
set(CPACK_INSTALL_PREFIX "/usr/")
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
set(CPACK_RESOURCE_FILE_LICENSE "${AMDIS_SOURCE_DIR}/license.opensource.txt")

# library depends on boost, but boost libraries have version-number in name on some systems.
# so we have to find a workaround to enforce allowed boost versions
set(boost_ver ${Boost_MINOR_VERSION})
math(EXPR boost_ver_start "${Boost_MINOR_VERSION}+1")
math(EXPR boost_ver_stop "${Boost_MINOR_VERSION}+10")

set(boost_depends "libboost${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
set(boost_iostreams_depends "libboost-iostreams${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
set(boost_system_depends "libboost-system${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
set(boost_filesystem_depends "libboost-filesystem${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")

foreach(boost_ver RANGE ${boost_ver_start} ${boost_ver_stop})
  set(boost_depends "${boost_depends} | libboost${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
  set(boost_iostreams_depends "${boost_iostreams_depends} | libboost-iostreams${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
  set(boost_system_depends "${boost_system_depends} | libboost-system${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
  set(boost_filesystem_depends "${boost_filesystem_depends} | libboost-filesystem${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})")
endforeach(boost_ver)
502

503
504
configure_file(${AMDIS_SOURCE_DIR}/cmake/preinst.in
  ${AMDIS_BINARY_DIR}/preinst
Naumann, Andreas's avatar
Naumann, Andreas committed
505
506
  @ONLY)

507
508
configure_file(${AMDIS_SOURCE_DIR}/cmake/postrm.in
  ${AMDIS_BINARY_DIR}/postrm
Naumann, Andreas's avatar
Naumann, Andreas committed
509
  @ONLY)
510

511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
#----Test if clang setup works----------------------------------------------------------------------
set(COMPILER_VERSION "")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  exec_program(${CMAKE_C_COMPILER} ARGS "-v" OUTPUT_VARIABLE _clang_version_info)
  string(REGEX REPLACE "^.*[ ]([0-9]+)\\.[0-9].*$" "\\1" CLANG_MAJOR "${_clang_version_info}")
  string(REGEX REPLACE "^.*[ ][0-9]+\\.([0-9]).*$" "\\1" CLANG_MINOR "${_clang_version_info}")
  set(COMPILER_VERSION "clang ${CLANG_MAJOR}.${CLANG_MINOR}")
endif()

#---Obtain the major and minor version of the GNU compiler-------------------------------------------
if (CMAKE_COMPILER_IS_GNUCXX)
  exec_program(${CMAKE_C_COMPILER} ARGS "-dumpversion" OUTPUT_VARIABLE _gcc_version_info)
  string(REGEX REPLACE "^([0-9]+).*$"                   "\\1" GCC_MAJOR ${_gcc_version_info})
  string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$"          "\\1" GCC_MINOR ${_gcc_version_info})
  string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCC_PATCH ${_gcc_version_info})

  if(GCC_PATCH MATCHES "\\.+")
    set(GCC_PATCH "")
  endif()
  if(GCC_MINOR MATCHES "\\.+")
    set(GCC_MINOR "")
  endif()
  if(GCC_MAJOR MATCHES "\\.+")
    set(GCC_MAJOR "")
  endif()
  set(COMPILER_VERSION "gcc ${_gcc_version_info}")
endif()
538

539
540
541
set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}, ${RPM_DEPEND_STR}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${boost_depends},\\n ${boost_iostreams_depends},\\n ${boost_system_depends},\\n ${boost_filesystem_depends}")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "AMDiS (Adaptive Multi-Dimensional Simulations) - a C++ library to solve partial differential equations using adaptive finite elements. The main features of AMDiS are:
542
 .
543
544
545
546
547
548
  - full adaptive meshes in 1D, 2D and 3D
  - adaptive time stepping strategies for time dependent equations
  - uses high performance Krylov subspace solvers from MTL4 and the direct solvers UMFPACK and Intel's Pardiso
  - parallelization of the overall finite element method with excelent scaling up to several thounds of processors
  - uses PETSc for solving parallel distributed linear systems
  - easy to use interface, no additional effort to run code in parallel!
549
 .
550
551
  The library is compiled with ${COMPILER_VERSION} and compiled/linked with boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}.")

552
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${AMDIS_BINARY_DIR}/preinst" "${AMDIS_BINARY_DIR}/postrm")
Naumann, Andreas's avatar
Naumann, Andreas committed
553

554
include(CPack)