CMakeLists.txt 20.5 KB
Newer Older
1
project(AMDIS)
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>)

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)
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)

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
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)
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
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})
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
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
272

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

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

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

291

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

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

297
FILE(GLOB HEADERS "${SOURCE_DIR}/*.h")
298
INSTALL(FILES ${HEADERS}
299
	DESTINATION include/amdis/)
300 301
list(APPEND deb_add_dirs "include/amdis")

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

307
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
308
INSTALL(FILES ${HEADERS}
309
	DESTINATION include/amdis/)
310

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

315
FILE(GLOB HEADERS "${SOURCE_DIR}/parallel/*.h")
316
INSTALL(FILES ${HEADERS}
317
	DESTINATION include/amdis/parallel/)
318 319
list(APPEND deb_add_dirs "include/amdis/parallel")

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

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

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

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

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

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

350
FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h")
351
INSTALL(FILES ${HEADERS}
352
	DESTINATION include/amdis/time/)
353 354
list(APPEND deb_add_dirs "include/amdis/time")

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

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

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

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

375
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/itl/*.hpp")
376
INSTALL(FILES ${HEADERS}
377 378
	DESTINATION include/amdis/solver/itl)
list(APPEND deb_add_dirs "include/amdis/solver/itl")
379

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


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

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

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

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

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

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

424
INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake
425
	DESTINATION share/amdis/)
426 427
list(APPEND deb_add_dirs "share/amdis/")

428
FILE(GLOB CMAKE_FILES "${AMDIS_SOURCE_DIR}/cmake/*.cmake")
429
INSTALL(FILES ${CMAKE_FILES}
430
	DESTINATION share/amdis/)
431

432
#install mtl
433
INSTALL(DIRECTORY ${AMDIS_SOURCE_DIR}/lib/mtl4/
434 435 436 437 438 439
	DESTINATION include/amdis/mtl4/
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ".svn" EXCLUDE
	PATTERN ".svn/*" EXCLUDE
	PATTERN "mtl4/libs" EXCLUDE
	PATTERN "mtl4/extern" EXCLUDE
440
       )
441 442
FILE(GLOB_RECURSE mtl4_files
		RELATIVE ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/
443
		${AMDIS_SOURCE_DIR}/lib/mtl4/boost/*.hpp)
444
foreach(mtl4_file in ${mtl4_files})
445 446
    get_filename_component(mtl4File_path ${mtl4_file} PATH)
    list(APPEND deb_add_dirs "include/amdis/mtl4/boost/${mtl4File_path}")
447
endforeach(mtl4_file)
448 449 450 451 452 453

#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")

454
list(REMOVE_DUPLICATES deb_add_dirs)
455

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


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

496 497
configure_file(${AMDIS_SOURCE_DIR}/cmake/preinst.in
  ${AMDIS_BINARY_DIR}/preinst
498 499
  @ONLY)

500 501
configure_file(${AMDIS_SOURCE_DIR}/cmake/postrm.in
  ${AMDIS_BINARY_DIR}/postrm
502
  @ONLY)
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 530
#----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()
531

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

545
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${AMDIS_BINARY_DIR}/preinst" "${AMDIS_BINARY_DIR}/postrm")
546

547
include(CPack)