CMakeLists.txt 33.1 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
8
if(POLICY CMP0042)
	cmake_policy(SET CMP0042 NEW)
endif()
	
9
10
SET(LIB_DIR ${AMDIS_SOURCE_DIR}/lib)
SET(SOURCE_DIR ${AMDIS_SOURCE_DIR}/src)
11

12
#TODO: use the cmake build type
13
SET(MTL_INCLUDE_DIR ${LIB_DIR}/mtl4/ CACHE PATH "mtl4 directory")
14

15
16
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
17
18
19
20
21
find_package(Subversion)
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}")
22
endif()
23
set(CurrentRevision "0.9")
24
25
26
27
28
29
if(NOT AMDIS_MAJOR)
  set(AMDIS_MAJOR "0")
endif()
if(NOT AMDIS_MINOR)
  set(AMDIS_MINOR "9")
endif()
30
list(APPEND COMPILEFLAGS "-DAMDIS_VERSION=${CurrentRevision}")
31
32
33
34
35
36

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

37
38
if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
	Message("Compiler: Intel")
39
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable 654 -diag-disable 858") 
40
41
endif()

Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
42

43
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
44
45
option(USE_PETSC_DEV false)
option(ENABLE_ZOLTAN false)
Praetorius, Simon's avatar
Praetorius, Simon committed
46
option(ENABLE_CXX11 "Enable C++11 compiler features" false)
47
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
48
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
49
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
Praetorius, Simon's avatar
Praetorius, Simon committed
50
option(ENABLE_PNG "use png reader/writer" false)
51
option(ENABLE_BDDCML "Use of BDDCML library" false)
52
option(ENABLE_EXTENSIONS "Use extensions" false)
Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
53
option(ENABLE_OPENMP "Use OpenMP" false)
54
option(ENABLE_COMPRESSION "Use output compression" false)
55
option(ENABLE_OUTPUT "AMDiS output printing, disable only for debugging!" true)
Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
56
57
58


mark_as_advanced(ENABLE_OUTPUT)
59
60
mark_as_advanced(ENABLE_BDDCML)
mark_as_advanced(USE_PETSC_DEV)
Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
61

Naumann, Andreas's avatar
Naumann, Andreas committed
62

63
find_package(Boost 1.44 REQUIRED)
64
if(Boost_FOUND)
65
  list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
66
67
68
69
70
  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")
71
  endif(WIN32)
72
  list(APPEND AMDIS_LINK_DIRS ${Boost_LIBRARY_DIRS})
73
endif(Boost_FOUND)
Naumann, Andreas's avatar
Naumann, Andreas committed
74

75

Thomas Witkowski's avatar
Thomas Witkowski committed
76
77
SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
	      ${SOURCE_DIR}/AdaptInfo.cc
78
	      ${SOURCE_DIR}/AdaptInstationary.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
79
	      ${SOURCE_DIR}/AdaptStationary.cc
80
	      ${SOURCE_DIR}/AMDiS.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
81
82
83
84
	      ${SOURCE_DIR}/Assembler.cc
	      ${SOURCE_DIR}/BasisFunction.cc
	      ${SOURCE_DIR}/Boundary.cc
	      ${SOURCE_DIR}/BoundaryManager.cc
85
	      ${SOURCE_DIR}/BoundaryObject.cc
86
	      ${SOURCE_DIR}/Bubble.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
87
88
89
90
91
92
	      ${SOURCE_DIR}/Cholesky.cc
	      ${SOURCE_DIR}/CoarseningManager.cc
	      ${SOURCE_DIR}/CoarseningManager1d.cc
	      ${SOURCE_DIR}/CoarseningManager2d.cc
	      ${SOURCE_DIR}/CoarseningManager3d.cc
	      ${SOURCE_DIR}/ComponentTraverseInfo.cc
93
	      ${SOURCE_DIR}/CouplingIterationInterface.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
94
95
96
97
98
	      ${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
99
	      ${SOURCE_DIR}/Debug.cc
100
	      ${SOURCE_DIR}/DirichletBC.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
101
102
103
104
105
106
107
108
109
	      ${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
110
	      ${SOURCE_DIR}/ElementRegion_ED.cc	
Thomas Witkowski's avatar
Thomas Witkowski committed
111
112
113
114
115
116
117
	      ${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
118
	      ${SOURCE_DIR}/Initfile.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
119
120
121
122
123
	      ${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
124
	      ${SOURCE_DIR}/MatrixVector.cc
125
# 	      ${SOURCE_DIR}/Test_MatrixVectorOperations.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
126
127
128
129
130
131
	      ${SOURCE_DIR}/Mesh.cc
	      ${SOURCE_DIR}/MeshStructure.cc
	      ${SOURCE_DIR}/Operator.cc
	      ${SOURCE_DIR}/OperatorTerm.cc
	      ${SOURCE_DIR}/Parametric.cc
	      ${SOURCE_DIR}/PeriodicBC.cc
132
	      #${SOURCE_DIR}/ProblemImplicit.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
133
	      ${SOURCE_DIR}/ProblemInstat.cc
134
135
136
	      ${SOURCE_DIR}/ProblemInterpol.cc
	      ${SOURCE_DIR}/ProblemStat.cc
	      ${SOURCE_DIR}/ProblemStatDbg.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	      ${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
151
	      ${SOURCE_DIR}/Serializer.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
152
153
154
155
156
	      ${SOURCE_DIR}/StandardProblemIteration.cc
	      ${SOURCE_DIR}/SubAssembler.cc
	      ${SOURCE_DIR}/SubElInfo.cc
	      ${SOURCE_DIR}/SubQuadrature.cc
	      ${SOURCE_DIR}/SurfaceQuadrature.cc
157
158
	      ${SOURCE_DIR}/SurfaceRegion_ED.cc
	      ${SOURCE_DIR}/SystemVector.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
159
	      ${SOURCE_DIR}/Tetrahedron.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
160
	      ${SOURCE_DIR}/Timer.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
161
162
163
164
165
	      ${SOURCE_DIR}/Traverse.cc
	      ${SOURCE_DIR}/Triangle.cc
	      ${SOURCE_DIR}/VertexVector.cc
	      ${SOURCE_DIR}/ZeroOrderAssembler.cc
	      ${SOURCE_DIR}/ZeroOrderTerm.cc
166
167
168
169
	      ${SOURCE_DIR}/est/Estimator.cc
	      ${SOURCE_DIR}/est/RecoveryEstimator.cc
	      ${SOURCE_DIR}/est/ResidualEstimator.cc
	      ${SOURCE_DIR}/est/SimpleResidualEstimator.cc
170
	      ${SOURCE_DIR}/io/ArhReader.cc
171
172
	      ${SOURCE_DIR}/io/detail/ArhReader.cc
              ${SOURCE_DIR}/io/Arh2Reader.cc
173
              ${SOURCE_DIR}/io/Arh2Writer.cc
Siqi Ling's avatar
Siqi Ling committed
174
175
              ${SOURCE_DIR}/io/Arh3Reader.cc
              ${SOURCE_DIR}/io/Arh3Writer.cc
176
177
178
              ${SOURCE_DIR}/io/detail/Arh2Reader.cc
	      ${SOURCE_DIR}/io/detail/ArhWriter.cc
              ${SOURCE_DIR}/io/detail/Arh2Writer.cc
Siqi Ling's avatar
Siqi Ling committed
179
180
              ${SOURCE_DIR}/io/detail/Arh3Reader.cc
              ${SOURCE_DIR}/io/detail/Arh3Writer.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
181
182
	      ${SOURCE_DIR}/io/DofWriter.cc
	      ${SOURCE_DIR}/io/ElementFileWriter.cc
183
	      ${SOURCE_DIR}/io/FileWriterInterface.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
184
185
186
187
188
	      ${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
189
	      ${SOURCE_DIR}/io/PngReader.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
190
191
	      ${SOURCE_DIR}/io/PngWriter.cc
	      ${SOURCE_DIR}/io/PovrayWriter.cc
192
	      ${SOURCE_DIR}/io/Spreadsheet.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
193
194
195
	      ${SOURCE_DIR}/io/ValueReader.cc
	      ${SOURCE_DIR}/io/ValueWriter.cc
	      ${SOURCE_DIR}/io/VtkWriter.cc
196
	      ${SOURCE_DIR}/io/VtkVectorWriter.cc
197
              ${SOURCE_DIR}/io/detail/VtkWriter.cc
198
	      ${SOURCE_DIR}/nonlin/ProblemNonLin.cc
199
	      ${SOURCE_DIR}/solver/SolverMatrix.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
200
	      ${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
201
	      ${SOURCE_DIR}/time/RosenbrockMethod.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
202
	      ${SOURCE_DIR}/time/RosenbrockStationary.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
203
	      )
Praetorius, Simon's avatar
Praetorius, Simon committed
204
	      
205
if(ENABLE_PARALLEL_DOMAIN)
206
207
208
	
	### Search for MPI compiler and get compile flags and include paths. ###

Naumann, Andreas's avatar
Naumann, Andreas committed
209
	find_package(MPI REQUIRED)
210
	if(MPI_FOUND)
211
	  list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
212
213
	  include_directories(${MPI_INCLUDE_PATH})
	endif(MPI_FOUND)
214
 
215
216
217
218
219
220
221
222
223
224
225
226


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

227
228
229
230
231
232
233
#	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)
234
235
236
237
238


	
	### Search for Zoltan ###

239
	if(ENABLE_ZOLTAN)
240
241
	  find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" PATH ENV CPATH)
	  if(ZOLTAN_HEADER_FILE)
242
		get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
243
		include_directories(${ZOLTAN_HEADER_DIR})
244
	  else()
245
246
247
		message(FATAL_ERROR "Could not find Zoltan include file!")
	  endif(ZOLTAN_HEADER_FILE)

248
	  list(APPEND COMPILEFLAGS "-DHAVE_ZOLTAN")
249
250
	endif(ENABLE_ZOLTAN)

251
252


253
	list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")
Naumann, Andreas's avatar
Naumann, Andreas committed
254
	SET(PARALLEL_DOMAIN_AMDIS_SRC
255
		${SOURCE_DIR}/parallel/BddcMlSolver.cc
256
               	${SOURCE_DIR}/parallel/DofComm.cc
257
		${SOURCE_DIR}/parallel/CheckerPartitioner.cc
258
		${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
259
		${SOURCE_DIR}/parallel/InteriorBoundary.cc
260
		${SOURCE_DIR}/parallel/MeshDistributor.cc 
261
		${SOURCE_DIR}/parallel/MeshLevelData.cc 
262
		${SOURCE_DIR}/parallel/MeshManipulation.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
263
		${SOURCE_DIR}/parallel/MeshPartitioner.cc
264
		${SOURCE_DIR}/parallel/MpiHelper.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
265
		${SOURCE_DIR}/parallel/ParallelDebug.cc
266
		${SOURCE_DIR}/parallel/ParallelDofMapping.cc
267
268
		${SOURCE_DIR}/parallel/ParallelProblemStat.cc
		${SOURCE_DIR}/parallel/ParallelSolver.cc
269
		${SOURCE_DIR}/parallel/PeriodicMap.cc
270
		${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
271
		${SOURCE_DIR}/parallel/StdMpi.cc
272
		${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
273
274
275
276
277
278
		
	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)
279
		list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
280
		list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
281
		list(APPEND PARALLEL_DOMAIN_AMDIS_SRC 
282
			${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
283
			${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
284
			${SOURCE_DIR}/parallel/PetscHelper.cc
Thomas Witkowski's avatar
Thomas Witkowski committed
285
			${SOURCE_DIR}/parallel/PetscSolver.cc
286
			${SOURCE_DIR}/parallel/PetscSolverFeti.cc
287
288
			${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
			${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
289
290
			${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc
			${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc
291
			${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc
292
			${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc
293
			${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
294
			${SOURCE_DIR}/parallel/PetscSolverNSCH.cc
295
296
297
298
			${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
			${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc                        
			${SOURCE_DIR}/parallel/PetscSolverSchur.cc
			${SOURCE_DIR}/solver/PetscTypes.cc)
299
300
301
302
	elseif(ENABLE_PARALLEL_DOMAIN STREQUAL "PMTL")
		set(MTL_INCLUDE_DIR "")
		find_package(MTL REQUIRED)
		list(APPEND COMPILEFLAGS "-DMTL_HAS_MPI" "-DHAVE_PARALLEL_MTL4")
303
304
305
# 		list(APPEND PARALLEL_DOMAIN_AMDIS_SRC 
# 			${SOURCE_DIR}/parallel/PMTL_ProblemStat.cc
# 			)
306
		list(APPEND AMDIS_LIBS ${MTL_LIBRARIES})
307
	else()
308
		message(SEND_ERROR "Set the domain-decomposition version correctly.")
309
310
	endif()

311
312
	INSTALL(FILES ResolveCompilerPaths.cmake FindPackageMultipass.cmake FindPETSc.cmake
		DESTINATION share/amdis/)
313
	if(USE_PETSC_DEV)
314
	  list(APPEND COMPILEFLAGS "-DHAVE_PETSC_DEV")
Naumann, Andreas's avatar
Naumann, Andreas committed
315
	endif( USE_PETSC_DEV)
Naumann, Andreas's avatar
Naumann, Andreas committed
316
317
endif(ENABLE_PARALLEL_DOMAIN)

318

319
if(ENABLE_SEQ_PETSC)
320
321
322
323
324
325
326
327
328
329
330
  find_package(MPI REQUIRED)
  if(MPI_FOUND)
    list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
    include_directories(${MPI_INCLUDE_PATH})
  endif(MPI_FOUND)
	
  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)
  list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
331
  list(APPEND COMPILEFLAGS "-DHAVE_SEQ_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
332
333
334
335
  
  list(APPEND AMDIS_SRC   
	${SOURCE_DIR}/solver/PetscSolver.cc
	${SOURCE_DIR}/solver/PetscTypes.cc)
336
endif(ENABLE_SEQ_PETSC)
337
338

if(ENABLE_UMFPACK)
339
	find_file(UMFPACK_H umfpack.h
340
			    HINTS ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse
341
342
			    DOC "headerfile umfpack.h for UMFPACK")
	if(UMFPACK_H)
343
344
		get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
		include_directories(${UMFPACK_PATH} ${UFCONFIG_PATH} ${AMD_PATH})
345
		list(APPEND COMPILEFLAGS "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK")
346
	else()
Praetorius, Simon's avatar
Praetorius, Simon committed
347
		message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.")
348
	endif()
349
	SET(RPM_DEPEND_STR "blas")
Naumann, Andreas's avatar
Naumann, Andreas committed
350
endif(ENABLE_UMFPACK)
Praetorius, Simon's avatar
Praetorius, Simon committed
351
352


353
if(ENABLE_HYPRE)
354
  include(HYPREConfig.cmake)
355
  message("have hypre: ${HAVE_HYPRE}")
356
357
  if (HAVE_HYPRE)
    if (NOT MPI_FOUND)
358
      find_package(MPI REQUIRED)
359
      if (MPI_FOUND)
360
361
362
363
364
365
366
367
368
369
370
	list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
	include_directories(${MPI_INCLUDE_PATH})
      endif()
    endif()
    include_directories(${HYPRE_INCLUDE_DIRECTORIES})
    list(APPEND COMPILEFLAGS "-DMTL_HAS_HYPRE")
    list(APPEND MYLIBS ${HYPRE_LIBRARIES} )
  endif()
endif(ENABLE_HYPRE)
  
  
Praetorius, Simon's avatar
Praetorius, Simon committed
371
372
373
374
375
376
377
378
379
380
381
382
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
383

384
385
386
if(ENABLE_COMPRESSION)
  list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1")
endif(ENABLE_COMPRESSION)
387

Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
388
389
390
391
392
393
if(NOT ENABLE_OUTPUT)
       message(WARNING "AMDiS cout output disabled!")
       list(APPEND COMPILEFLAGS "-DSUPPRESS_OUTPUT")
endif(NOT ENABLE_OUTPUT)


394
if(ENABLE_BDDCML)
395
396
	SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML")
		
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
	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()
419

Thomas Witkowski's avatar
Thomas Witkowski committed
420
421
422
423

	find_file(BLOPEX_PATH blopex
			      HINTS ENV CPATH
			      DOC "Path to BLOPEX library.")
424
425
426
endif(ENABLE_BDDCML)


427
if(ENABLE_EXTENSIONS)
Praetorius, Simon's avatar
Praetorius, Simon committed
428
429
430
431
  option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
  find_path(EXTENSIONS_DIR NAMES Helpers.h 
			   HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../extensions
			   DOC "Path to AMDiS extensions.")
432
433
434
435
436
  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()
  
437
438
439
440
441
      SET(EXTENSIONS_SRC
	      ${EXTENSIONS_DIR}/Helpers.cc
	      ${EXTENSIONS_DIR}/BackgroundMesh.cc
	      ${EXTENSIONS_DIR}/GeometryTools.cc
	      ${EXTENSIONS_DIR}/POperators.cc
442
	      ${EXTENSIONS_DIR}/SingularDirichletBC2.cc
443
	      ${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
444
	      ${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp)
445
	      
446
      if(ENABLE_SEQ_PETSC)
447
448
	list(APPEND EXTENSIONS_SRC
	      ${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
449
	      ${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
450
	      ${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
451
      endif(ENABLE_SEQ_PETSC)
452
      
453
454
      if(ENABLE_PARALLEL_DOMAIN)
	list(APPEND EXTENSIONS_SRC
Praetorius, Simon's avatar
Praetorius, Simon committed
455
# 	      ${EXTENSIONS_DIR}/preconditioner/PetscSolverNavierStokes2.cc
456
457
	      ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
	      ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
458
459
      endif(ENABLE_PARALLEL_DOMAIN)
      
460
461
462
463
464
      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
465
466
467
468
469
      if(WIN32)
	add_library(extensions STATIC ${EXTENSIONS_SRC})
      else()
	add_library(extensions SHARED ${EXTENSIONS_SRC})
      endif()
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
      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/)
487
488
489
490
491
492
493
	      
      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/preconditioner/*.h")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/preconditioner/)
      FILE(GLOB HEADERS "${EXTENSIONS_DIR}/preconditioner/*.hh")
      INSTALL(FILES ${HEADERS}
	      DESTINATION include/amdis/extensions/preconditioner/)
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509

      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
510
	      DESTINATION lib/amdis/ )
511
512
513
514
515

# === baseProblems ====================================================================
      
      if(ENABLE_BASE_PROBLEMS)
	  SET(BASE_PROBLEMS_SRC
516
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
517
518
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
519
520
521
522
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase.cc
		  ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
523
524
		  ${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
		  ${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
525
# 		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
526
		  ${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
527
# 		  ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
528
		  ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
529
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
530
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
531
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
532
		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
Praetorius, Simon's avatar
Praetorius, Simon committed
533
		  ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
534
		  ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
535
536
		  ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc
		  ${EXTENSIONS_DIR}/base_problems/PolarizationField.cc
537
538
539
540
		  ${EXTENSIONS_DIR}/base_problems/QuasiCrystal.cc
		  ${EXTENSIONS_DIR}/base_problems/QuasiCrystal_RB.cc
# 		  ${EXTENSIONS_DIR}/base_problems/VacancyPhaseFieldCrystal.cc
		  )
541
542
	list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
	list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
Praetorius, Simon's avatar
Praetorius, Simon committed
543
544
545
546
547
	if(WIN32)
	  add_library(base_problems STATIC ${BASE_PROBLEMS_SRC})
	else()
	  add_library(base_problems SHARED ${BASE_PROBLEMS_SRC})
	endif()
548
549
550
551
552
553
554
555
556
557
558
559
	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
560
		DESTINATION lib/amdis/ )
561
    
562
563
564
      endif(ENABLE_BASE_PROBLEMS)
    endif()
  endif()
565
566
endif(ENABLE_EXTENSIONS)

567

Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
568
if(ENABLE_OPENMP)
Thomas Witkowski's avatar
Thomas Witkowski committed
569
570
571
572
573
  if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
	list(APPEND COMPILEFLAGS "-openmp")
  else()
        list(APPEND COMPILEFLAGS "-fopenmp")
  endif()
Thomas Witkowski's avatar
Blub  
Thomas Witkowski committed
574
575
endif(ENABLE_OPENMP)

576
SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM)
Thomas Witkowski's avatar
Thomas Witkowski committed
577
578
579
580
581
582
583
584
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
585
586
		      ${COMPOSITE_SOURCE_DIR}/SubElementAssembler.cc )

587
588
589
590
set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit)
file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc)
include_directories(${REINIT_SOURCE_DIR})

591
592

#muparser includes
593
set(MUPARSER_SOURCE_DIR ${AMDIS_SOURCE_DIR}/lib/muparser_v134)
594
file(GLOB MUPARSER_SRC ${MUPARSER_SOURCE_DIR}/src/*.cpp)
595
list(APPEND AMDIS_INCLUDE_DIRS ${MUPARSER_SOURCE_DIR}/include)
596

Naumann, Andreas's avatar
Naumann, Andreas committed
597
#mtl4 includes
598
list(APPEND AMDIS_INCLUDE_DIRS ${MTL_INCLUDE_DIR})
599
#include_directories(${MTL_INCLUDE_DIR})
600
list(APPEND AMDIS_INCLUDE_DIRS ${SOURCE_DIR})
601

602
#include_directories(${SOURCE_DIR})
603
include_directories(${AMDIS_INCLUDE_DIRS})
Naumann, Andreas's avatar
Naumann, Andreas committed
604

Praetorius, Simon's avatar
Praetorius, Simon committed
605
606
607
608
609
610
611
612
613
614
615
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()
616

Praetorius, Simon's avatar
Praetorius, Simon committed
617
618
#target_link_libraries(compositeFEM amdis)
#target_link_libraries(reinit amdis)
619
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
620

621
if(WIN32)
622
	list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS")
623
endif(WIN32)
624
625


Praetorius, Simon's avatar
Praetorius, Simon committed
626
627
if (ENABLE_CXX11)
  list(APPEND COMPILEFLAGS "-DHAS_CXX11=1")
Praetorius, Simon's avatar
Praetorius, Simon committed
628
  if (${CMAKE_VERSION} VERSION_GREATER "3.0")
Praetorius, Simon's avatar
Praetorius, Simon committed
629
630
631
632
633
634
635
636
637
638
    set_property(TARGET "amdis" PROPERTY CXX_STANDARD 11)
    set_property(TARGET "compositeFEM" PROPERTY CXX_STANDARD 11)
    set_property(TARGET "reinit" PROPERTY CXX_STANDARD 11)
    set_property(TARGET "muparser" PROPERTY CXX_STANDARD 11)
    
    set_property(TARGET "amdis" PROPERTY CXX_STANDARD_REQUIRED ON)
    set_property(TARGET "compositeFEM" PROPERTY CXX_STANDARD_REQUIRED ON)
    set_property(TARGET "reinit" PROPERTY CXX_STANDARD_REQUIRED ON)
    set_property(TARGET "muparser" PROPERTY CXX_STANDARD_REQUIRED ON)
    
Praetorius, Simon's avatar
Praetorius, Simon committed
639
640
641
  else()
    list(APPEND COMPILEFLAGS "-std=c++11")
  endif()
Praetorius, Simon's avatar
Praetorius, Simon committed
642
643
644
645
646
647
else ()
  list(APPEND COMPILEFLAGS "-DHAS_CXX11=0")
endif (ENABLE_CXX11)
        


648
649
650
651
652
653
654
655
656
657
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")
 
     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()

658
message("compileflags: ${COMPILEFLAGS}")
659
660
#SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}")
add_definitions(${COMPILEFLAGS})
661

Naumann, Andreas's avatar
Naumann, Andreas committed
662
663
664
665
if(ENABLE_MARMOT)
	Message("please set marmotcc manually")
endif(ENABLE_MARMOT)

666
#dont change this destination. the GUI depends on it to guess the buildsystem
667

668
FILE(GLOB HEADERS "${SOURCE_DIR}/*.h")
669
670
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
671
672
list(APPEND deb_add_dirs "include/amdis")

673
674
675
676
677
FILE(GLOB HEADERS "${SOURCE_DIR}/config/*.h*")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/config/)
list(APPEND deb_add_dirs "include/amdis/config")

678
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
679
680
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
681

682
683
684
685
FILE(GLOB HEADERS "${SOURCE_DIR}/*.hpp")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)

686
FILE(GLOB HEADERS "${SOURCE_DIR}/parallel/*.h")
687
688
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/parallel/)
Naumann, Andreas's avatar
Naumann, Andreas committed
689
690
list(APPEND deb_add_dirs "include/amdis/parallel")

691
692
693
694
695
FILE(GLOB HEADERS "${SOURCE_DIR}/nonlin/*.h")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/nonlin/)
list(APPEND deb_add_dirs "include/amdis/nonlin")

696
697
698
699
700
FILE(GLOB HEADERS "${SOURCE_DIR}/est/*.h")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/est/)
list(APPEND deb_add_dirs "include/amdis/est")

701
FILE(GLOB HEADERS "${SOURCE_DIR}/expressions/*.h*")
702
703
704
705
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/expressions/)
list(APPEND deb_add_dirs "include/amdis/expressions")

706
707
708
709
710
711
712
713
714
715
FILE(GLOB HEADERS "${SOURCE_DIR}/operations/*.h*")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/operations/)
list(APPEND deb_add_dirs "include/amdis/operations")

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

Praetorius, Simon's avatar
Praetorius, Simon committed
716
717
718
719
720
FILE(GLOB HEADERS "${SOURCE_DIR}/utility/*.h*")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/utility/)
list(APPEND deb_add_dirs "include/amdis/utility")

721
FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h")
722
723
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/time/)
Naumann, Andreas's avatar
Naumann, Andreas committed
724
725
list(APPEND deb_add_dirs "include/amdis/time")

726
727
728
729
730
731
732
733
734
735
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.h")
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")

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

Siqi Ling's avatar
Siqi Ling committed
736
737
738
739
740
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h")
INSTALL(FILES ${HEADERS} 
        DESTINATION include/amdis/solver/details)
list(APPEND deb_add_dirs "include/amdis/solver/details")

741
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/itl/*.hpp")
742
INSTALL(FILES ${HEADERS} 
743
744
	DESTINATION include/amdis/solver/itl)
list(APPEND deb_add_dirs "include/amdis/solver/itl")
Naumann, Andreas's avatar
Naumann, Andreas committed
745

746
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h")
Naumann, Andreas's avatar
Naumann, Andreas committed
747
748
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
Naumann, Andreas's avatar
Naumann, Andreas committed
749
750
list(APPEND deb_add_dirs "include/amdis/io")

751
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
Naumann, Andreas's avatar
Naumann, Andreas committed
752
753
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
754
755
756
757
758
	
FILE(GLOB HEADERS "${SOURCE_DIR}/io/detail/*h")
INSTALL(FILES ${HEADERS}
        DESTINATION include/amdis/io/detail)
list(APPEND deb_add_dirs "include/amdis/io/detail")        
759

Praetorius, Simon's avatar
Praetorius, Simon committed
760
761
762
763
764
765
766
767
768
769
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")

770
771
772
773
774
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
775
list(APPEND deb_add_dirs "lib/amdis")
776
install(TARGETS amdis compositeFEM reinit muparser
Praetorius, Simon's avatar
Praetorius, Simon committed
777
	DESTINATION lib/amdis/ )
Praetorius, Simon's avatar
Praetorius, Simon committed
778

779
780
configure_file(${AMDIS_SOURCE_DIR}/AMDISConfig.cmake.in
		${AMDIS_BINARY_DIR}/AMDISConfig.cmake
781
782
		@ONLY
	      )
783

784
INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake 
785
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
786
787
list(APPEND deb_add_dirs "share/amdis/")

788
789
790
791
# INSTALL(FILES ${AMDIS_SOURCE_DIR}/AMDISUse.cmake 
# 	DESTINATION share/amdis/)
FILE(GLOB CMAKE_FILES "${AMDIS_SOURCE_DIR}/*.cmake")
INSTALL(FILES ${CMAKE_FILES}
792
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
793

794
#install mtl
795
INSTALL(DIRECTORY ${AMDIS_SOURCE_DIR}/lib/mtl4/
796
797
798
799
800
801
	DESTINATION include/amdis/mtl4/
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ".svn" EXCLUDE
	PATTERN ".svn/*" EXCLUDE
	PATTERN "mtl4/libs" EXCLUDE
	PATTERN "mtl4/extern" EXCLUDE
802
       )
Naumann, Andreas's avatar
Naumann, Andreas committed
803
FILE(GLOB_RECURSE mtl4_files 
804
805
		RELATIVE ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/ 
		${AMDIS_SOURCE_DIR}/lib/mtl4/boost/*.hpp)
Naumann, Andreas's avatar
Naumann, Andreas committed
806
807
foreach(mtl4_file in ${mtl4_files})
 get_filename_component(mtl4File_path ${mtl4_file} PATH)
808
 list(APPEND deb_add_dirs "include/amdis/mtl4/boost/${mtl4File_path}")
Naumann, Andreas's avatar
Naumann, Andreas committed
809
endforeach(mtl4_file)
810
811
812
813
814
815

#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
816
list(REMOVE_DUPLICATES deb_add_dirs)
817

Praetorius, Simon's avatar
Praetorius, Simon committed
818
819
ENABLE_TESTING()
INCLUDE(CTest)
820
821
822
INCLUDE(Dart)
if(NOT CTEST_MODEL)
        set(CTEST_MODEL "Experimental")
Praetorius, Simon's avatar
Praetorius, Simon committed
823
endif()
824
825
if( NOT N_TEST_PROC) 
	set(N_TEST_PROC "8")
Praetorius, Simon's avatar
Praetorius, Simon committed
826
endif()
827
828
configure_file(myMake.sh.in myMake.sh @ONLY)
configure_file(CTestScript.cmake.in CTestScript.cmake @ONLY)
Praetorius, Simon's avatar
Praetorius, Simon committed
829
830


831
832
# PACKAGES
# ========================================================
833
set(CPACK_PACKAGE_NAME "AMDIS")
834
set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de")
835
set(CPACK_PACKAGE_VERSION "${CurrentRevision}")
836
837
set(CPACK_GENERATOR "RPM" "DEB" "TGZ")
set(CPACK_INSTALL_PREFIX "/usr/")
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
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)
857

858
859
configure_file(${AMDIS_SOURCE_DIR}/preinst.in 
  ${AMDIS_BINARY_DIR}/preinst 
Naumann, Andreas's avatar
Naumann, Andreas committed
860
861
  @ONLY)

862
863
configure_file(${AMDIS_SOURCE_DIR}/postrm.in 
  ${AMDIS_BINARY_DIR}/postrm 
Naumann, Andreas's avatar
Naumann, Andreas committed
864
  @ONLY)
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
  
#----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:
897
 . 
898
899
900
901
902
903
  - 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!
904
 . 
905
906
  The library is compiled with ${COMPILER_VERSION} and compiled/linked with boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}.")

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

909
include(CPack)