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

3
cmake_minimum_required(VERSION 2.6)
4 5 6

SET(LIB_DIR ${AMDIS_SOURCE_DIR}/lib)
SET(SOURCE_DIR ${AMDIS_SOURCE_DIR}/src)
7

8
#TODO: use the cmake build type
9
SET(MTL_INCLUDE_DIR ${LIB_DIR}/mtl4/ CACHE PATH "mtl4 directory")
10

11 12
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG=0") #-Wno-unused-but-set-variable
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -O0") #-Wno-unused-but-set-variable
13 14 15 16 17 18 19 20 21 22 23 24 25 26
if(NOT CurrentRevision)
	find_package(Subversion)
	if(Subversion_FOUND)
	  Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} svn_info)
	  #message("svn-rev: ${svn_info_WC_REVISION}")
	  set(CurrentRevision "0.9.${svn_info_WC_REVISION}")
	endif()
endif()
if(NOT AMDIS_MAJOR)
  set(AMDIS_MAJOR "0")
endif()
if(NOT AMDIS_MINOR)
  set(AMDIS_MINOR "9")
endif()
27
set(COMPILEFLAGS "-DAMDIS_VERSION=${CurrentRevision}")
28 29 30 31 32 33

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

34 35 36 37 38
if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
	Message("Compiler: Intel")
	set(CMAKE_CXX_FLAGS "-diag-disable 654 -diag-disable 858") 
endif()

Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
39

40
SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" )
Naumann, Andreas's avatar
Naumann, Andreas committed
41 42
option(USE_PETSC_DEV false)
option(ENABLE_ZOLTAN false)
43
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
Praetorius, Simon's avatar
Praetorius, Simon committed
44
option(ENABLE_PNG "use png reader/writer" false)
45
option(ENABLE_BDDCML "Use of BDDCML library" false)
46
option(ENABLE_EXTENSIONS "Use extensions" false)
Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
47 48 49 50 51 52
option(ENABLE_OPENMP "Use OpenMP" false)
option(ENABLE_OUTPUT "AMDiS output priniting, disable only for debugging!" true)


mark_as_advanced(ENABLE_OUTPUT)

Naumann, Andreas's avatar
Naumann, Andreas committed
53

54 55
find_package(Boost 1.42 REQUIRED)
if(Boost_FOUND)
56
  list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
57 58 59 60 61
  message("boost lib-dirs: ${Boost_LIBRARY_DIRS}")
  message("use the boost dir: ${Boost_INCLUDE_DIR}")
  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")
62
  endif(WIN32)
63
  list(APPEND AMDIS_LINK_DIRS ${Boost_LIBRARY_DIRS})
64
endif(Boost_FOUND)
Naumann, Andreas's avatar
Naumann, Andreas committed
65

66

Thomas Witkowski's avatar
Thomas Witkowski committed
67 68
SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
	      ${SOURCE_DIR}/AdaptInfo.cc
69
	      ${SOURCE_DIR}/AdaptInstationary.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
70
	      ${SOURCE_DIR}/AdaptStationary.cc
71
	      ${SOURCE_DIR}/AMDiS.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
72 73 74 75
	      ${SOURCE_DIR}/Assembler.cc
	      ${SOURCE_DIR}/BasisFunction.cc
	      ${SOURCE_DIR}/Boundary.cc
	      ${SOURCE_DIR}/BoundaryManager.cc
76
	      ${SOURCE_DIR}/BoundaryObject.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
77 78 79 80 81 82
	      ${SOURCE_DIR}/Cholesky.cc
	      ${SOURCE_DIR}/CoarseningManager.cc
	      ${SOURCE_DIR}/CoarseningManager1d.cc
	      ${SOURCE_DIR}/CoarseningManager2d.cc
	      ${SOURCE_DIR}/CoarseningManager3d.cc
	      ${SOURCE_DIR}/ComponentTraverseInfo.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
83
              ${SOURCE_DIR}/CouplingIterationInterface.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
84 85 86 87 88
	      ${SOURCE_DIR}/CreatorMap.cc
	      ${SOURCE_DIR}/DOFAdmin.cc
	      ${SOURCE_DIR}/DOFIndexed.cc
	      ${SOURCE_DIR}/DOFMatrix.cc
	      ${SOURCE_DIR}/DOFVector.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
89
	      ${SOURCE_DIR}/Debug.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
90 91 92 93 94 95 96 97 98 99
	      ${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
100
	      ${SOURCE_DIR}/ElementRegion_ED.cc	
Thomas Witkowski's avatar
Thomas Witkowski committed
101 102 103 104 105 106 107
	      ${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
Praetorius, Simon's avatar
Praetorius, Simon committed
108
              ${SOURCE_DIR}/Initfile.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
109 110 111 112 113
	      ${SOURCE_DIR}/Lagrange.cc
	      ${SOURCE_DIR}/LeafData.cc
	      ${SOURCE_DIR}/Line.cc
	      ${SOURCE_DIR}/MacroElement.cc
	      ${SOURCE_DIR}/Marker.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
114
	      ${SOURCE_DIR}/MatrixVector.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
115 116 117 118 119 120 121 122
	      ${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}/ProblemImplicit.cc
	      ${SOURCE_DIR}/ProblemInstat.cc
123 124 125
	      ${SOURCE_DIR}/ProblemInterpol.cc
	      ${SOURCE_DIR}/ProblemStat.cc
	      ${SOURCE_DIR}/ProblemStatDbg.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139
	      ${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
140
	      ${SOURCE_DIR}/Serializer.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
141
	      ${SOURCE_DIR}/StandardProblemIteration.cc
142
	      ${SOURCE_DIR}/SolverMatrix.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
143 144 145 146
	      ${SOURCE_DIR}/SubAssembler.cc
	      ${SOURCE_DIR}/SubElInfo.cc
	      ${SOURCE_DIR}/SubQuadrature.cc
	      ${SOURCE_DIR}/SurfaceQuadrature.cc
147 148
	      ${SOURCE_DIR}/SurfaceRegion_ED.cc
	      ${SOURCE_DIR}/SystemVector.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
149
	      ${SOURCE_DIR}/Tetrahedron.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
150
	      ${SOURCE_DIR}/Timer.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
151 152 153 154 155
	      ${SOURCE_DIR}/Traverse.cc
	      ${SOURCE_DIR}/Triangle.cc
	      ${SOURCE_DIR}/VertexVector.cc
	      ${SOURCE_DIR}/ZeroOrderAssembler.cc
	      ${SOURCE_DIR}/ZeroOrderTerm.cc
156 157 158 159
	      ${SOURCE_DIR}/est/Estimator.cc
	      ${SOURCE_DIR}/est/RecoveryEstimator.cc
	      ${SOURCE_DIR}/est/ResidualEstimator.cc
	      ${SOURCE_DIR}/est/SimpleResidualEstimator.cc
160 161
	      ${SOURCE_DIR}/io/ArhReader.cc
	      ${SOURCE_DIR}/io/ArhWriter.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
162 163 164 165 166 167 168
	      ${SOURCE_DIR}/io/DofWriter.cc
	      ${SOURCE_DIR}/io/ElementFileWriter.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
Praetorius, Simon's avatar
Praetorius, Simon committed
169
	      ${SOURCE_DIR}/io/PngReader.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
170 171
	      ${SOURCE_DIR}/io/PngWriter.cc
	      ${SOURCE_DIR}/io/PovrayWriter.cc
172
	      ${SOURCE_DIR}/io/Spreadsheet.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
173 174 175
	      ${SOURCE_DIR}/io/ValueReader.cc
	      ${SOURCE_DIR}/io/ValueWriter.cc
	      ${SOURCE_DIR}/io/VtkWriter.cc
176
	      ${SOURCE_DIR}/io/VtkVectorWriter.cc
177
	      ${SOURCE_DIR}/nonlin/ProblemNonLin.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
178
	      ${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
179
	      ${SOURCE_DIR}/time/RosenbrockMethod.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
180
	      ${SOURCE_DIR}/time/RosenbrockStationary.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
181 182
	      )

183
if(ENABLE_PARALLEL_DOMAIN)
184 185 186
	
	### Search for MPI compiler and get compile flags and include paths. ###

Naumann, Andreas's avatar
Naumann, Andreas committed
187
	find_package(MPI REQUIRED)
188
	if(MPI_FOUND)
189
	  list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
190 191
	  include_directories(${MPI_INCLUDE_PATH})
	endif(MPI_FOUND)
192
 
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216


	### Search for ParMetis ###

	find_file(PARMETIS_HEADER_FILE "parmetis.h" PATH ENV CPATH)
	if(PARMETIS_HEADER_FILE)
		get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE)
		include_directories(${PARMETIS_INCLUDE_PATH})
	else()
		message(FATAL_ERROR "Could not find ParMetis header file!")
	endif(PARMETIS_HEADER_FILE)

	find_file(PARMETIS_LIB_FILE "libparmetis.a" PATH ENV LIBRARY_PATH)
	if(PARMETIS_LIB_FILE)
		get_filename_component(PARMETIS_LINK_PATH "${PARMETIS_LIB_FILE}" PATH CACHE)
		link_directories(${PARMETIS_LINK_PATH})
	else()
		message(FATAL_ERROR "Could not find ParMetis library file!")
	endif(PARMETIS_LIB_FILE)


	
	### Search for Zoltan ###

217
	if(ENABLE_ZOLTAN)
218 219
	  find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" PATH ENV CPATH)
	  if(ZOLTAN_HEADER_FILE)
220
		get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
221
		include_directories(${ZOLTAN_HEADER_DIR})
222
	  else()
223 224 225
		message(FATAL_ERROR "Could not find Zoltan include file!")
	  endif(ZOLTAN_HEADER_FILE)

226
	  list(APPEND COMPILEFLAGS "-DHAVE_ZOLTAN")
227 228
	endif(ENABLE_ZOLTAN)

229 230


231
	list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")
Naumann, Andreas's avatar
Naumann, Andreas committed
232
	SET(PARALLEL_DOMAIN_AMDIS_SRC
233
               	${SOURCE_DIR}/parallel/DofComm.cc
234
		${SOURCE_DIR}/parallel/CheckerPartitioner.cc
235
		${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
236
		${SOURCE_DIR}/parallel/InteriorBoundary.cc
237
		${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
238
		${SOURCE_DIR}/parallel/MeshDistributor.cc 
239
		${SOURCE_DIR}/parallel/MeshLevelData.cc 
240
		${SOURCE_DIR}/parallel/MeshManipulation.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
241
		${SOURCE_DIR}/parallel/MeshPartitioner.cc
242
		${SOURCE_DIR}/parallel/MpiHelper.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
243
		${SOURCE_DIR}/parallel/ParallelDebug.cc
244
		${SOURCE_DIR}/parallel/ParallelDofMapping.cc
245
		${SOURCE_DIR}/parallel/ParallelProblemStatBase.cc
246
		${SOURCE_DIR}/parallel/PeriodicMap.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
247 248
                ${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
		${SOURCE_DIR}/parallel/StdMpi.cc
249
		${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
250 251 252 253 254 255
		
	if(ENABLE_PARALLEL_DOMAIN STREQUAL "PETSC")
		set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};/usr/share/cmake-2.8/Modules/;${CMAKE_SOURCE_DIR}/")
		set(PETSC_EXECUTABLE_RUNS ON)
		find_package(PETSc REQUIRED)
		include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
256
		list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
257 258
		list(APPEND PARALLEL_DOMAIN_AMDIS_SRC 
			${SOURCE_DIR}/parallel/BddcMlSolver.cc
259
			${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
260
			${SOURCE_DIR}/parallel/PetscHelper.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
261
			${SOURCE_DIR}/parallel/PetscSolver.cc
262 263
			${SOURCE_DIR}/parallel/PetscProblemStat.cc
			${SOURCE_DIR}/parallel/PetscSolverFeti.cc
264 265
			${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
			${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
266 267
			${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc
			${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc
268
			${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc
269
			${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc
270
			${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
271
			${SOURCE_DIR}/parallel/PetscSolverNSCH.cc
272 273
                        ${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
                        ${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc                        
274
			${SOURCE_DIR}/parallel/PetscSolverSchur.cc)
275 276 277 278 279
	elseif(ENABLE_PARALLEL_DOMAIN STREQUAL "PMTL")
		set(MTL_INCLUDE_DIR "")
		find_package(MTL REQUIRED)
		list(APPEND COMPILEFLAGS "-DMTL_HAS_MPI" "-DHAVE_PARALLEL_MTL4")
		list(APPEND PARALLEL_DOMAIN_AMDIS_SRC ${SOURCE_DIR}/parallel/Mtl4Solver.cc)
280
		list(APPEND AMDIS_LIBS ${MTL_LIBRARIES})
281
	else()
282
		message(SEND_ERROR "Set the domain-decomposition version correctly.")
283 284
	endif()

285 286
	INSTALL(FILES ResolveCompilerPaths.cmake FindPackageMultipass.cmake FindPETSc.cmake
		DESTINATION share/amdis/)
287
	if(USE_PETSC_DEV)
288
	  list(APPEND COMPILEFLAGS "-DHAVE_PETSC_DEV")
Naumann, Andreas's avatar
Naumann, Andreas committed
289
	endif( USE_PETSC_DEV)
Naumann, Andreas's avatar
Naumann, Andreas committed
290 291
endif(ENABLE_PARALLEL_DOMAIN)

292

293 294

if(ENABLE_UMFPACK)
295
	find_file(UMFPACK_H umfpack.h
296
			    HINTS ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse
297 298
			    DOC "headerfile umfpack.h for UMFPACK")
	if(UMFPACK_H)
299 300
		get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
		include_directories(${UMFPACK_PATH} ${UFCONFIG_PATH} ${AMD_PATH})
301
		list(APPEND COMPILEFLAGS "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK")
302
	else()
Praetorius, Simon's avatar
Praetorius, Simon committed
303
		message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.")
304
	endif()
305
	SET(RPM_DEPEND_STR "blas")
Naumann, Andreas's avatar
Naumann, Andreas committed
306
endif(ENABLE_UMFPACK)
Praetorius, Simon's avatar
Praetorius, Simon committed
307 308 309 310 311 312 313 314 315 316 317 318 319 320


if(ENABLE_PNG)
	find_file(PNG_H png.h
			    HINTS ENV CPATH /usr/include
			    DOC "headerfile png.h for PNG-READER")
	if(PNG_H)
		get_filename_component(PNG_PATH ${PNG_H} PATH)
		include_directories(${PNG_PATH})
		list(APPEND COMPILEFLAGS "-DHAVE_PNG=1")
	else()
		message(FATAL_ERROR "Could not find the PNG header png.h.")
	endif()
endif(ENABLE_PNG)
Naumann, Andreas's avatar
Naumann, Andreas committed
321

322

Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
323 324 325 326 327 328
if(NOT ENABLE_OUTPUT)
       message(WARNING "AMDiS cout output disabled!")
       list(APPEND COMPILEFLAGS "-DSUPPRESS_OUTPUT")
endif(NOT ENABLE_OUTPUT)


329
if(ENABLE_BDDCML)
330 331
	SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML")
		
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
	find_file(BDDCML_H bddcml_interface_c.h
			   HINTS ENV CPATH
			   DOC "Header bddcml_interface_c.h for the BDDCML library.")

	if(BDDCML_H)
		get_filename_component(BDDCML_PATH ${BDDCML_H} PATH)
		include_directories(${BDDCML_PATH})		
		list(APPEND COMPILEFLAGS "-DHAVE_BDDC_ML=1")
		list(APPEND COMPILEFLAGS "-DAdd_")
	else()
		message(FATAL_ERROR "Could not find BDDCML headers.")
	endif()

	find_library(BDDCML_LIB bddcml
				HINTS ENV LIBRARY_PATH
				DOC "BDDCML library")

	if(BDDCML_LIB)
		list(APPEND AMDIS_LIBS ${BDDCML_LIB})
	else()
		message(FATAL_ERROR "Could not find the BDDCML library")
	endif()
354

Thomas Witkowski's avatar
Thomas Witkowski committed
355 356 357 358

	find_file(BLOPEX_PATH blopex
			      HINTS ENV CPATH
			      DOC "Path to BLOPEX library.")
359 360 361
endif(ENABLE_BDDCML)


362
if(ENABLE_EXTENSIONS)
363
  option(ENABLE_BASE_PROBLEMS "Use base_problems" false)
364 365 366 367 368 369
  find_path(EXTENSIONS_DIR NAMES ${SOURCE_DIR}/../../extensions/Helpers.h DOC "Path to AMDiS extensions.")
  if (EXTENSIONS_DIR)
    if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/base_problems/BaseProblem.h)
      message(FATAL_ERROR "Wrong extensions directory! Directory must contain the 'Helpers.h' and the subdirectory 'base_problems'")
    else()
  
370 371 372 373 374 375 376 377 378 379 380 381
      SET(EXTENSIONS_SRC
	      ${EXTENSIONS_DIR}/Helpers.cc
	      ${EXTENSIONS_DIR}/BackgroundMesh.cc
	      ${EXTENSIONS_DIR}/GeometryTools.cc
	      ${EXTENSIONS_DIR}/POperators.cc
	      ${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
	      ${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp)
      list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
      list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR})
      list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/time)
      list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/nanoflann)
      list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/pugixml/src)
Praetorius, Simon's avatar
Praetorius, Simon committed
382 383 384 385 386
      if(WIN32)
	add_library(extensions STATIC ${EXTENSIONS_SRC})
      else()
	add_library(extensions SHARED ${EXTENSIONS_SRC})
      endif()
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
      list(APPEND AMDIS_LIBS extensions)

      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.h")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/)
      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.hh")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/)

      list(APPEND deb_add_dirs "include/amdis/extensions")

      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.h")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/time/)
      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.hh")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/time/)

      list(APPEND deb_add_dirs "include/amdis/extensions/time")

      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/nanoflann/*.hpp")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/nanoflann/)

      list(APPEND deb_add_dirs "include/amdis/extensions/nanoflann")

      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/pugixml/)

      list(APPEND deb_add_dirs "include/amdis/extensions/pugixml")

      install(TARGETS extensions
Praetorius, Simon's avatar
Praetorius, Simon committed
420
	      DESTINATION lib/amdis/ )
421 422 423 424 425 426

# === baseProblems ====================================================================
      
      if(ENABLE_BASE_PROBLEMS)
	  SET(BASE_PROBLEMS_SRC
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
427 428
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
429 430 431 432
    # 	      ${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
		  ${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
		  ${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
    # 	      ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
433
		  ${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
434 435 436 437 438 439 440 441 442 443 444
		  ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Base.cc
    # 	      ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
# 		  ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
		  ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc)
	list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
	list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
Praetorius, Simon's avatar
Praetorius, Simon committed
445 446 447 448 449
	if(WIN32)
	  add_library(base_problems STATIC ${BASE_PROBLEMS_SRC})
	else()
	  add_library(base_problems SHARED ${BASE_PROBLEMS_SRC})
	endif()
450 451 452 453 454 455 456 457 458 459 460 461
	list(APPEND AMDIS_LIBS base_problems)

	FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.h")
	INSTALL(FILES ${HEADERS}
		DESTINATION include/amdis/base_problems/)
	FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.hh")
	INSTALL(FILES ${HEADERS}
		DESTINATION include/amdis/base_problems/)

	list(APPEND deb_add_dirs "include/amdis/base_problems")

	install(TARGETS base_problems
Praetorius, Simon's avatar
Praetorius, Simon committed
462
		DESTINATION lib/amdis/ )
463
    
464 465 466
      endif(ENABLE_BASE_PROBLEMS)
    endif()
  endif()
467 468
endif(ENABLE_EXTENSIONS)

469

Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
470
if(ENABLE_OPENMP)
Thomas Witkowski's avatar
Thomas Witkowski committed
471 472 473 474 475
  if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
	list(APPEND COMPILEFLAGS "-openmp")
  else()
        list(APPEND COMPILEFLAGS "-fopenmp")
  endif()
Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
476 477
endif(ENABLE_OPENMP)

478
SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM)
Thomas Witkowski's avatar
Thomas Witkowski committed
479 480 481 482 483 484 485 486
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
487 488
		      ${COMPOSITE_SOURCE_DIR}/SubElementAssembler.cc )

489 490 491 492
set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit)
file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc)
include_directories(${REINIT_SOURCE_DIR})

493 494

#muparser includes
495
set(MUPARSER_SOURCE_DIR ${AMDIS_SOURCE_DIR}/lib/muparser_v134)
496
file(GLOB MUPARSER_SRC ${MUPARSER_SOURCE_DIR}/src/*.cpp)
497
list(APPEND AMDIS_INCLUDE_DIRS ${MUPARSER_SOURCE_DIR}/include)
498

Naumann, Andreas's avatar
Naumann, Andreas committed
499
#mtl4 includes
500
list(APPEND AMDIS_INCLUDE_DIRS ${MTL_INCLUDE_DIR})
501
#include_directories(${MTL_INCLUDE_DIR})
502
list(APPEND AMDIS_INCLUDE_DIRS ${SOURCE_DIR})
503

504
#include_directories(${SOURCE_DIR})
505
include_directories(${AMDIS_INCLUDE_DIRS})
Naumann, Andreas's avatar
Naumann, Andreas committed
506

Praetorius, Simon's avatar
Praetorius, Simon committed
507 508 509 510 511 512 513 514 515 516 517
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()
518

Praetorius, Simon's avatar
Praetorius, Simon committed
519 520
#target_link_libraries(compositeFEM amdis)
#target_link_libraries(reinit amdis)
521
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
522

523
if(WIN32)
524
	list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS")
525
endif(WIN32)
526
message("compileflags: ${COMPILEFLAGS}")
527 528
#SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}")
add_definitions(${COMPILEFLAGS})
529

Naumann, Andreas's avatar
Naumann, Andreas committed
530 531 532 533
if(ENABLE_MARMOT)
	Message("please set marmotcc manually")
endif(ENABLE_MARMOT)

534
#dont change this destination. the GUI depends on it to guess the buildsystem
535

536
FILE(GLOB HEADERS "${SOURCE_DIR}/*.h")
537 538
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
539 540
list(APPEND deb_add_dirs "include/amdis")

541
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
542 543
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
544

545
FILE(GLOB HEADERS "${SOURCE_DIR}/parallel/*.h")
546 547
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/parallel/)
Naumann, Andreas's avatar
Naumann, Andreas committed
548 549
list(APPEND deb_add_dirs "include/amdis/parallel")

550 551 552 553 554
FILE(GLOB HEADERS "${SOURCE_DIR}/nonlin/*.h")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/nonlin/)
list(APPEND deb_add_dirs "include/amdis/nonlin")

555 556 557 558 559
FILE(GLOB HEADERS "${SOURCE_DIR}/est/*.h")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/est/)
list(APPEND deb_add_dirs "include/amdis/est")

560
FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h")
561 562
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/time/)
Naumann, Andreas's avatar
Naumann, Andreas committed
563 564
list(APPEND deb_add_dirs "include/amdis/time")

565
FILE(GLOB HEADERS "${SOURCE_DIR}/itl/*.hpp")
566 567
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/itl)
Naumann, Andreas's avatar
Naumann, Andreas committed
568 569
list(APPEND deb_add_dirs "include/amdis/itl")

570
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h")
Naumann, Andreas's avatar
Naumann, Andreas committed
571 572
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
Naumann, Andreas's avatar
Naumann, Andreas committed
573 574
list(APPEND deb_add_dirs "include/amdis/io")

575
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
Naumann, Andreas's avatar
Naumann, Andreas committed
576 577
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
578

Praetorius, Simon's avatar
Praetorius, Simon committed
579 580 581 582 583 584 585 586 587 588
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")

589 590 591 592 593
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
594
list(APPEND deb_add_dirs "lib/amdis")
595
install(TARGETS amdis compositeFEM reinit muparser
Praetorius, Simon's avatar
Praetorius, Simon committed
596
	DESTINATION lib/amdis/ )
Praetorius, Simon's avatar
Praetorius, Simon committed
597

598 599
configure_file(${AMDIS_SOURCE_DIR}/AMDISConfig.cmake.in
		${AMDIS_BINARY_DIR}/AMDISConfig.cmake
600 601
		@ONLY
	      )
602

603
INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake 
604
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
605 606
list(APPEND deb_add_dirs "share/amdis/")

607
INSTALL(FILES ${AMDIS_SOURCE_DIR}/AMDISUse.cmake 
608
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
609

610
#install mtl
611
INSTALL(DIRECTORY ${AMDIS_SOURCE_DIR}/lib/mtl4/
612 613 614 615 616 617
	DESTINATION include/amdis/mtl4/
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ".svn" EXCLUDE
	PATTERN ".svn/*" EXCLUDE
	PATTERN "mtl4/libs" EXCLUDE
	PATTERN "mtl4/extern" EXCLUDE
618
       )
Naumann, Andreas's avatar
Naumann, Andreas committed
619
FILE(GLOB_RECURSE mtl4_files 
620 621
		RELATIVE ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/ 
		${AMDIS_SOURCE_DIR}/lib/mtl4/boost/*.hpp)
Naumann, Andreas's avatar
Naumann, Andreas committed
622 623
foreach(mtl4_file in ${mtl4_files})
 get_filename_component(mtl4File_path ${mtl4_file} PATH)
624
 list(APPEND deb_add_dirs "include/amdis/mtl4/boost/${mtl4File_path}")
Naumann, Andreas's avatar
Naumann, Andreas committed
625
endforeach(mtl4_file)
626 627 628 629 630 631

#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
632
list(REMOVE_DUPLICATES deb_add_dirs)
633

634 635
# PACKAGES
# ========================================================
636
set(CPACK_PACKAGE_NAME "AMDIS")
637
set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de")
638
set(CPACK_PACKAGE_VERSION "${CurrentRevision}")
639 640
set(CPACK_GENERATOR "RPM" "DEB" "TGZ")
set(CPACK_INSTALL_PREFIX "/usr/")
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659
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)
660

661 662
configure_file(${AMDIS_SOURCE_DIR}/preinst.in 
  ${AMDIS_BINARY_DIR}/preinst 
Naumann, Andreas's avatar
Naumann, Andreas committed
663 664
  @ONLY)

665 666
configure_file(${AMDIS_SOURCE_DIR}/postrm.in 
  ${AMDIS_BINARY_DIR}/postrm 
Naumann, Andreas's avatar
Naumann, Andreas committed
667
  @ONLY)
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
  
#----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()
  
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:
 
  - 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!
 
  The library is compiled with ${COMPILER_VERSION} and compiled/linked with boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}.")

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

712
include(CPack)