CMakeLists.txt 20.5 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
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
271

272 273
# some special treatements for Windows systems
# --------------------------------------------
274
if(WIN32)
275
	list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS")
276
endif(WIN32)
277

278 279
# some special treatements for MacOS Systems
# ------------------------------------------
280 281 282 283
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")
284

285 286 287 288 289
     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()

290

291
message("compileflags: ${COMPILEFLAGS}")
292
add_definitions(${COMPILEFLAGS})
293

294
#dont change this destination. the GUI depends on it to guess the buildsystem
295

296
FILE(GLOB HEADERS "${SOURCE_DIR}/*.h")
297
INSTALL(FILES ${HEADERS}
298
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
299 300
list(APPEND deb_add_dirs "include/amdis")

301
FILE(GLOB HEADERS "${SOURCE_DIR}/config/*.h*")
302
INSTALL(FILES ${HEADERS}
303 304 305
	DESTINATION include/amdis/config/)
list(APPEND deb_add_dirs "include/amdis/config")

306
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
307
INSTALL(FILES ${HEADERS}
308
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
309

310
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hpp")
311
INSTALL(FILES ${HEADERS}
312 313
	DESTINATION include/amdis/)

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

319
FILE(GLOB HEADERS "${SOURCE_DIR}/nonlin/*.h")
320
INSTALL(FILES ${HEADERS}
321 322 323
	DESTINATION include/amdis/nonlin/)
list(APPEND deb_add_dirs "include/amdis/nonlin")

324
FILE(GLOB HEADERS "${SOURCE_DIR}/est/*.h")
325
INSTALL(FILES ${HEADERS}
326 327 328
	DESTINATION include/amdis/est/)
list(APPEND deb_add_dirs "include/amdis/est")

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

334
FILE(GLOB HEADERS "${SOURCE_DIR}/operations/*.h*")
335
INSTALL(FILES ${HEADERS}
336 337 338 339
	DESTINATION include/amdis/operations/)
list(APPEND deb_add_dirs "include/amdis/operations")

FILE(GLOB HEADERS "${SOURCE_DIR}/traits/*.h*")
340
INSTALL(FILES ${HEADERS}
341 342 343
	DESTINATION include/amdis/traits/)
list(APPEND deb_add_dirs "include/amdis/traits")

Praetorius, Simon's avatar
Praetorius, Simon committed
344
FILE(GLOB HEADERS "${SOURCE_DIR}/utility/*.h*")
345
INSTALL(FILES ${HEADERS}
Praetorius, Simon's avatar
Praetorius, Simon committed
346 347 348
	DESTINATION include/amdis/utility/)
list(APPEND deb_add_dirs "include/amdis/utility")

349
FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h")
350
INSTALL(FILES ${HEADERS}
351
	DESTINATION include/amdis/time/)
Naumann, Andreas's avatar
Naumann, Andreas committed
352 353
list(APPEND deb_add_dirs "include/amdis/time")

354
FILE(GLOB HEADERS "${SOURCE_DIR}/traits/*.h*")
355
INSTALL(FILES ${HEADERS}
356 357 358
	DESTINATION include/amdis/traits/)
list(APPEND deb_add_dirs "include/amdis/traits")

359
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.h")
360
INSTALL(FILES ${HEADERS}
361 362 363 364
	DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")

FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.hh")
365
INSTALL(FILES ${HEADERS}
366 367 368
	DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")

Siqi Ling's avatar
Siqi Ling committed
369
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h")
370
INSTALL(FILES ${HEADERS}
Siqi Ling's avatar
Siqi Ling committed
371 372 373
        DESTINATION include/amdis/solver/details)
list(APPEND deb_add_dirs "include/amdis/solver/details")

374
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/itl/*.hpp")
375
INSTALL(FILES ${HEADERS}
376 377
	DESTINATION include/amdis/solver/itl)
list(APPEND deb_add_dirs "include/amdis/solver/itl")
Naumann, Andreas's avatar
Naumann, Andreas committed
378

379
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h")
380
INSTALL(FILES ${HEADERS}
381 382 383 384
	DESTINATION include/amdis/solver/details)
list(APPEND deb_add_dirs "include/amdis/solver/details")


385
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h")
Naumann, Andreas's avatar
Naumann, Andreas committed
386 387
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
Naumann, Andreas's avatar
Naumann, Andreas committed
388 389
list(APPEND deb_add_dirs "include/amdis/io")

390
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
Naumann, Andreas's avatar
Naumann, Andreas committed
391 392
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
393

394 395 396
FILE(GLOB HEADERS "${SOURCE_DIR}/io/detail/*h")
INSTALL(FILES ${HEADERS}
        DESTINATION include/amdis/io/detail)
397
list(APPEND deb_add_dirs "include/amdis/io/detail")
398

Praetorius, Simon's avatar
Praetorius, Simon committed
399 400 401 402 403 404 405 406 407 408
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")

409 410 411 412 413
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
414
list(APPEND deb_add_dirs "lib/amdis")
415
install(TARGETS amdis compositeFEM reinit muparser
Praetorius, Simon's avatar
Praetorius, Simon committed
416
	DESTINATION lib/amdis/ )
Praetorius, Simon's avatar
Praetorius, Simon committed
417

418
configure_file(${AMDIS_SOURCE_DIR}/cmake/AMDISConfig.cmake.in
419
		${AMDIS_BINARY_DIR}/AMDISConfig.cmake
420 421
		@ONLY
	      )
422

423
INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake
424
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
425 426
list(APPEND deb_add_dirs "share/amdis/")

427
FILE(GLOB CMAKE_FILES "${AMDIS_SOURCE_DIR}/cmake/*.cmake")
428
INSTALL(FILES ${CMAKE_FILES}
429
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
430

431
#install mtl
432
INSTALL(DIRECTORY ${AMDIS_SOURCE_DIR}/lib/mtl4/
433 434 435 436 437 438
	DESTINATION include/amdis/mtl4/
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ".svn" EXCLUDE
	PATTERN ".svn/*" EXCLUDE
	PATTERN "mtl4/libs" EXCLUDE
	PATTERN "mtl4/extern" EXCLUDE
439
       )
440 441
FILE(GLOB_RECURSE mtl4_files
		RELATIVE ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/
442
		${AMDIS_SOURCE_DIR}/lib/mtl4/boost/*.hpp)
Naumann, Andreas's avatar
Naumann, Andreas committed
443
foreach(mtl4_file in ${mtl4_files})
444 445
    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
446
endforeach(mtl4_file)
447 448 449 450 451 452

#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
453
list(REMOVE_DUPLICATES deb_add_dirs)
454

Praetorius, Simon's avatar
Praetorius, Simon committed
455 456
ENABLE_TESTING()
INCLUDE(CTest)
457 458 459
INCLUDE(Dart)
if(NOT CTEST_MODEL)
        set(CTEST_MODEL "Experimental")
Praetorius, Simon's avatar
Praetorius, Simon committed
460
endif()
461
if( NOT N_TEST_PROC)
462
	set(N_TEST_PROC "8")
Praetorius, Simon's avatar
Praetorius, Simon committed
463
endif()
464 465
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
466 467


468 469
# PACKAGES
# ========================================================
470
set(CPACK_PACKAGE_NAME "AMDIS")
471
set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de")
472
set(CPACK_PACKAGE_VERSION "${CurrentRevision}")
473 474
set(CPACK_GENERATOR "RPM" "DEB" "TGZ")
set(CPACK_INSTALL_PREFIX "/usr/")
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
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)
494

495 496
configure_file(${AMDIS_SOURCE_DIR}/cmake/preinst.in
  ${AMDIS_BINARY_DIR}/preinst
Naumann, Andreas's avatar
Naumann, Andreas committed
497 498
  @ONLY)

499 500
configure_file(${AMDIS_SOURCE_DIR}/cmake/postrm.in
  ${AMDIS_BINARY_DIR}/postrm
Naumann, Andreas's avatar
Naumann, Andreas committed
501
  @ONLY)
502

503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
#----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()
530

531 532 533
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:
534
 .
535 536 537 538 539 540
  - 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!
541
 .
542 543
  The library is compiled with ${COMPILER_VERSION} and compiled/linked with boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}.")

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

546
include(CPack)