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

3
4
5
cmake_minimum_required(VERSION 2.8)

set(AMDiS_SOURCE_DIR "${AMDiS_SOURCE_DIR}/src")
Naumann, Andreas's avatar
Naumann, Andreas committed
6
7
#needs: --enable-debug, enable-intel --enable-openmp --enable-parmetis --enable-parallel-domain --enable-umfpack --enable-mkl --enable-boost --enable-marmot

8
9
10
SET(LIB_DIR ./lib)
SET(SOURCE_DIR ${AMDiS_SOURCE_DIR})

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

14
15
16
17
18
19
20
21
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -Wall -DDEBUG=0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG=1 -O0")

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

Naumann, Andreas's avatar
Naumann, Andreas committed
22
23
24
#option(ENABLE_INTEL "use intel compiler" false)
option(ENABLE_OPENMP "use openmp" false)
option(ENABLE_PARALLEL_DOMAIN "use parallel domain decomposition" false)
25
26
27
set(ENABLE_PARMETIS off)
#SET(PETSC_DIR "" CACHE PATH "Petsc directory for parallel domain decomposition" )
#SET(PETSC_ARCH "" CACHE STRING "Petsc architecture")
Naumann, Andreas's avatar
Naumann, Andreas committed
28
29
option(ENABLE_UMFPACK "use umfpack solver" false)
option(ENABLE_MKL "use the mkl" false)
30
SET(MKL_DIR "" CACHE PATH "MKL directory")
31
option(ENABLE_TESTS "compile the tests" false)
Naumann, Andreas's avatar
Naumann, Andreas committed
32
33
34
35
36
37
38
39
40

if(ENABLE_INTEL)
	Message("please set the icc manually")
	INCLUDE (CMakeForceCompiler)
	CMAKE_FORCE_C_COMPILER(icc "intel C compiler")
	CMAKE_FORCE_CXX_COMPILER(icpc "intel C++ compiler")
	#SET(CMAKE_C_COMPILER "icc")
endif(ENABLE_INTEL)

41
42
43
44
45
46
47
48
49
50
51
find_package(Boost 1.42 REQUIRED)
if(Boost_FOUND)
  include_directories(${Boost_INCLUDE_DIR})
  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")
  endif(WIN32)		
  link_directories(${Boost_LIBRARY_DIRS})
endif(Boost_FOUND)
Naumann, Andreas's avatar
Naumann, Andreas committed
52

Naumann, Andreas's avatar
Naumann, Andreas committed
53
SET(LIB_DIR ./lib)
54
SET(SOURCE_DIR ${AMDiS_SOURCE_DIR})
55
SET(AMDIS_SRC ${SOURCE_DIR}/DOFIndexed.cc 
56
	      ${SOURCE_DIR}/io/GNUPlotWriter.cc 
57
58
59
60
61
62
63
64
65
	      ${SOURCE_DIR}/VertexVector.cc 
	      ${SOURCE_DIR}/PeriodicBC.cc 
	      ${SOURCE_DIR}/Recovery.cc 
	      ${SOURCE_DIR}/RecoveryEstimator.cc 
	      ${SOURCE_DIR}/ResidualEstimator.cc 
	      ${SOURCE_DIR}/Cholesky.cc 
	      ${SOURCE_DIR}/AdaptBase.cc
	      ${SOURCE_DIR}/StandardProblemIteration.cc 
	      ${SOURCE_DIR}/ProblemScal.cc 
66
67
	      ${SOURCE_DIR}/ProblemVec.cc
	      ${SOURCE_DIR}/ProblemImplicit.cc 
68
69
70
71
72
73
74
	      ${SOURCE_DIR}/ProblemVecDbg.cc 
	      ${SOURCE_DIR}/DualTraverse.cc 
	      ${SOURCE_DIR}/ElementData.cc 
	      ${SOURCE_DIR}/ComponentTraverseInfo.cc 
	      ${SOURCE_DIR}/CreatorMap.cc 
	      ${SOURCE_DIR}/ProblemInterpolScal.cc 
	      ${SOURCE_DIR}/ProblemInterpolVec.cc 
75
76
77
              ${SOURCE_DIR}/io/MacroInfo.cc
	      ${SOURCE_DIR}/io/MacroReader.cc 
	      ${SOURCE_DIR}/io/ValueReader.cc 
78
79
80
81
82
83
84
85
86
87
88
89
90
	      ${SOURCE_DIR}/Projection.cc 
	      ${SOURCE_DIR}/SubAssembler.cc 
	      ${SOURCE_DIR}/ZeroOrderAssembler.cc 
	      ${SOURCE_DIR}/FirstOrderAssembler.cc 
	      ${SOURCE_DIR}/SecondOrderAssembler.cc 
	      ${SOURCE_DIR}/Assembler.cc 
	      ${SOURCE_DIR}/AdaptInfo.cc 
	      ${SOURCE_DIR}/Marker.cc 
	      ${SOURCE_DIR}/SurfaceQuadrature.cc 
	      ${SOURCE_DIR}/LeafData.cc 
	      ${SOURCE_DIR}/BoundaryManager.cc 
	      ${SOURCE_DIR}/DirichletBC.cc 
	      ${SOURCE_DIR}/RobinBC.cc  
91
92
	      ${SOURCE_DIR}/io/FileWriter.cc 
	      ${SOURCE_DIR}/io/ElementFileWriter.cc 
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
	      ${SOURCE_DIR}/ElInfo.cc 
	      ${SOURCE_DIR}/ElInfoStack.cc 
	      ${SOURCE_DIR}/OperatorTerm.cc 
              ${SOURCE_DIR}/ZeroOrderTerm.cc 
	      ${SOURCE_DIR}/FirstOrderTerm.cc 
	      ${SOURCE_DIR}/SecondOrderTerm.cc 
              ${SOURCE_DIR}/Operator.cc 
	      ${SOURCE_DIR}/Mesh.cc 
	      ${SOURCE_DIR}/MeshStructure.cc 
	      ${SOURCE_DIR}/AdaptStationary.cc  
	      ${SOURCE_DIR}/AdaptInstationary.cc
	      ${SOURCE_DIR}/DOFVector.cc 
	      ${SOURCE_DIR}/Estimator.cc 
	      ${SOURCE_DIR}/ProblemInstat.cc 
	      ${SOURCE_DIR}/ProblemNonLin.cc 
	      ${SOURCE_DIR}/NonLinUpdater.cc 
	      ${SOURCE_DIR}/QPsiPhi.cc 
	      ${SOURCE_DIR}/BasisFunction.cc 
	      ${SOURCE_DIR}/Boundary.cc 
	      ${SOURCE_DIR}/CoarseningManager.cc 
	      ${SOURCE_DIR}/CoarseningManager1d.cc 
	      ${SOURCE_DIR}/CoarseningManager2d.cc 
	      ${SOURCE_DIR}/CoarseningManager3d.cc 
	      ${SOURCE_DIR}/DOFAdmin.cc 
	      ${SOURCE_DIR}/DOFMatrix.cc 
	      ${SOURCE_DIR}/Element.cc 
	      ${SOURCE_DIR}/ElInfo1d.cc 
	      ${SOURCE_DIR}/ElInfo2d.cc 
	      ${SOURCE_DIR}/ElInfo3d.cc 
	      ${SOURCE_DIR}/FiniteElemSpace.cc 
	      ${SOURCE_DIR}/FixVec.cc 
	      ${SOURCE_DIR}/Global.cc 
	      ${SOURCE_DIR}/Lagrange.cc 
	      ${SOURCE_DIR}/Line.cc 
	      ${SOURCE_DIR}/MacroElement.cc 
128
	      ${SOURCE_DIR}/io/MacroWriter.cc 
129
130
131
132
133
134
135
136
137
138
139
140
	      ${SOURCE_DIR}/Parameters.cc 
	      ${SOURCE_DIR}/Parametric.cc 
	      ${SOURCE_DIR}/Quadrature.cc 
	      ${SOURCE_DIR}/RCNeighbourList.cc 
	      ${SOURCE_DIR}/RefinementManager.cc 
	      ${SOURCE_DIR}/RefinementManager1d.cc 
	      ${SOURCE_DIR}/RefinementManager2d.cc 
	      ${SOURCE_DIR}/RefinementManager3d.cc 
	      ${SOURCE_DIR}/Tetrahedron.cc 
	      ${SOURCE_DIR}/Traverse.cc 
	      ${SOURCE_DIR}/TraverseParallel.cc 
	      ${SOURCE_DIR}/Triangle.cc 
141
142
143
144
145
	      ${SOURCE_DIR}/io/ValueWriter.cc 
	      ${SOURCE_DIR}/io/VtkWriter.cc 
	      ${SOURCE_DIR}/io/PngWriter.cc 
	      ${SOURCE_DIR}/io/PovrayWriter.cc 
	      ${SOURCE_DIR}/io/DataCollector.cc 
146
147
148
149
	      ${SOURCE_DIR}/ScalableQuadrature.cc 
	      ${SOURCE_DIR}/SubElInfo.cc 
	      ${SOURCE_DIR}/parallel/InteriorBoundary.cc 
	      ${SOURCE_DIR}/ElementDofIterator.cc 
Naumann, Andreas's avatar
Naumann, Andreas committed
150
	      ${SOURCE_DIR}/Debug.cc
151
152
	      ${SOURCE_DIR}/io/ArhReader.cc
	      ${SOURCE_DIR}/io/ArhWriter.cc
153
154
155
              ${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc 
	      ${SOURCE_DIR}/time/RosenbrockStationary.cc 
	      ${SOURCE_DIR}/time/RosenbrockMethod.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
156
157
	      )

158
if(ENABLE_PARALLEL_DOMAIN)
Naumann, Andreas's avatar
Naumann, Andreas committed
159
160
161
162
	find_package(MPI REQUIRED)
	INCLUDE (CMakeForceCompiler)	
	CMAKE_FORCE_C_COMPILER(mpicc "MPI C compiler")
	CMAKE_FORCE_CXX_COMPILER(mpiCC "MPI C++ compiler")
163
164
165
166
167
 
	add_custom_target(parmetis-lib ALL
			make
			WORKING_DIRECTORY ${LIB_DIR}/ParMetis-3.1
			)
Naumann, Andreas's avatar
Naumann, Andreas committed
168
	include_directories( ${LIB_DIR}/ParMetis-3.1)
169
        INSTALL(FILES ${LIB_DIR}/ParMetis-3.1/parmetis.h
170
171
172
		${LIB_DIR}/ParMetis-3.1/libparmetis.a
		${LIB_DIR}/ParMetis-3.1/libmetis.a
		DESTINATION lib/parmetis
173
	       )
174
	set(ENABLE_PARMETIS ON)
Naumann, Andreas's avatar
Naumann, Andreas committed
175

176
	find_package(PETSc REQUIRED)
Naumann, Andreas's avatar
Naumann, Andreas committed
177
178
	include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
	SET(PARALLEL_DOMAIN_AMDIS_SRC
179
                ${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
180
		${SOURCE_DIR}/parallel/MeshDistributor.cc 
181
		${SOURCE_DIR}/parallel/MeshManipulation.cc
Naumann, Andreas's avatar
Naumann, Andreas committed
182
		${SOURCE_DIR}/parallel/StdMpi.cc
183
		${SOURCE_DIR}/parallel/ParallelDebug.cc
184
		${SOURCE_DIR}/parallel/MpiHelper.cc
185
186
		${SOURCE_DIR}/parallel/ElementObjectData.cc
		${SOURCE_DIR}/parallel/PetscSolver.cc)
Naumann, Andreas's avatar
Naumann, Andreas committed
187
188
189
190
	SET(COMPILEFLAGS "${COMPILEFLAGS} -DHAVE_PARALLEL_DOMAIN_AMDIS=1")
endif(ENABLE_PARALLEL_DOMAIN)

if(ENABLE_OPENMP)
191
192
193
194
195
196
	find_package(OpenMP)
	if(OPENMP_FOUND)
		SET(COMPILEFLAGS "${COMPILEFLAGS} ${OpenMP_CXX_FLAGS}")
	else()
		message(WARNING "your compiler seems support openmp")
	endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
197
198
199
200
201
endif(ENABLE_OPENMP)

if(ENABLE_UMFPACK)
	include_directories(${LIB_DIR}/UFconfig ${LIB_DIR}/AMD/Include ${LIB_DIR}/UMFPACK/Include)
	SET(COMPILEFLAGS "${COMPILEFLAGS} -DHAVE_UMFPACK=1 -DMTL_HAS_UMFPACK")
202
        FILE(GLOB UMFPACK_HEADERS "${LIB_DIR}/UMFPACK/Include/*.h")
203
204
	INSTALL(FILES ${UMFPACK_HEADERS} 
		DESTINATION include/amdis/umfpack/)
205

206
	FILE(GLOB UMFPACK_HEADERS "${LIB_DIR}/AMD/Include/*.h")
207
208
	INSTALL(FILES ${UMFPACK_HEADERS} 
		DESTINATION include/amdis/amd/)
209

210
	FILE(GLOB HEADERS "${LIB_DIR}/UFconfig/*.h")
211
212
	INSTALL(FILES ${HEADERS} 
		DESTINATION include/amdis/ufconfig/)
213

214
	FILE(GLOB HEADERS "${LIB_DIR}/UFconfig/xerbla/*.h")
215
216
	INSTALL(FILES ${HEADERS} 
		DESTINATION include/amdis/ufconfig/xerbla)
217

218
219
220
221
222
223
224
225
226
227
228
229
#add some rules to build the umfpack and amd libs
#	message("adding command for libumfpack:${CMAKE_CURRENT_SOURCE_DIR}/${LIB_DIR}/UMFPACK/Lib/libumfpack.a ")
	add_custom_target(umfpack-lib ALL
			make
			WORKING_DIRECTORY ${LIB_DIR}/UMFPACK
			)

	add_custom_target(amd-lib ALL
			 make
			WORKING_DIRECTORY ${LIB_DIR}/AMD
			)

230
231
232
233
234
	INSTALL(FILES ${LIB_DIR}/UMFPACK/Lib/libumfpack.a 
		DESTINATION lib/amdis/umfpack/)
	INSTALL(FILES ${LIB_DIR}/AMD/Lib/libamd.a 
		DESTINATION lib/amdis/amd/)
	SET(RPM_DEPEND_STR "blas")
235
	LIST(APPEND AMDiS_LIBS amdis blas amd umfpack)
Naumann, Andreas's avatar
Naumann, Andreas committed
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
endif(ENABLE_UMFPACK)

if(ENABLE_MKL)
	include_directories(${MKL_DIR})
	SET(COMPILEFLAGS "${COMPILEFLAGS} -DHAVE_MKL=1")
endif(ENABLE_MKL)

SET(COMPOSITE_SOURCE_DIR compositeFEM/src)
SET(COMPOSITE_FEM_SRC ${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc ${COMPOSITE_SOURCE_DIR}/CFE_NormAndErrorFcts.cc 
		      ${COMPOSITE_SOURCE_DIR}/CompositeFEMMethods.cc ${COMPOSITE_SOURCE_DIR}/LevelSetAdaptMesh.cc 
		      ${COMPOSITE_SOURCE_DIR}/PenaltyOperator.cc ${COMPOSITE_SOURCE_DIR}/ElementLevelSet.cc 
		      ${COMPOSITE_SOURCE_DIR}/CompositeFEMOperator.cc ${COMPOSITE_SOURCE_DIR}/SubPolytope.cc 
		      ${COMPOSITE_SOURCE_DIR}/SubElementAssembler.cc )

#mtl4 includes
251
include_directories(${MTL_DIR})
Naumann, Andreas's avatar
Naumann, Andreas committed
252
253
include_directories(${SOURCE_DIR})

254
add_library(amdis SHARED ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC})
Naumann, Andreas's avatar
Naumann, Andreas committed
255
add_library(compositeFEM SHARED ${COMPOSITE_FEM_SRC})
256
target_link_libraries(compositeFEM amdis)
257
LIST(APPEND AMDiS_LIBS amdis boost_system boost_iostreams)
258
259
260
if(WIN32)
	SET(COMPILEFLAGS "${COMPILEFLAGS} -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS")
endif(WIN32)
261
message("compileflags: ${COMPILEFLAGS}")
262
263
#SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}")
add_definitions(${COMPILEFLAGS})
Naumann, Andreas's avatar
Naumann, Andreas committed
264
265
266
267
268
if(ENABLE_MARMOT)
	Message("please set marmotcc manually")
endif(ENABLE_MARMOT)

install(TARGETS amdis compositeFEM 
269
	LIBRARY DESTINATION lib/amdis/ )
270
271

FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/*.h")
272
273
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)
274
FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/*.hh")
275
276
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/)
277
FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/parallel/*.h")
278
279
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/parallel/)
280
FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/time/*.h")
281
282
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/time/)
283
FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/itl/*.hpp")
284
285
INSTALL(FILES ${HEADERS} 
	DESTINATION include/amdis/itl)
Naumann, Andreas's avatar
Naumann, Andreas committed
286
287
288
289
290
291
FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/io/*.h")
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
FILE(GLOB HEADERS "${AMDiS_SOURCE_DIR}/io/*.hh")
INSTALL(FILES ${HEADERS}
	DESTINATION include/amdis/io)
292
293
294
295
296

configure_file(${AMDiS_BINARY_DIR}/AMDiSConfig.cmake.in
		${AMDiS_BINARY_DIR}/AMDiSConfig.cmake
		@ONLY
	      )
297
298
299
300
INSTALL(FILES ${AMDiS_BINARY_DIR}/AMDiSConfig.cmake 
	DESTINATION share/amdis/)
INSTALL(FILES ${AMDiS_BINARY_DIR}/AMDiSUse.cmake 
	DESTINATION share/amdis/)
Naumann, Andreas's avatar
Naumann, Andreas committed
301

302
303
#install mtl
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/lib/mtl4/
304
305
306
307
308
309
	DESTINATION include/amdis/mtl4/
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ".svn" EXCLUDE
	PATTERN ".svn/*" EXCLUDE
	PATTERN "mtl4/libs" EXCLUDE
	PATTERN "mtl4/extern" EXCLUDE
310
       )
311
312

#PACKAGES
313
314
315
316
317
318
319
320
321
#let cmake look for the svn-version
find_package(Subversion)
if(Subversion_FOUND)
	Subversion_WC_INFO(${CMAKE_CURRENT_BINARY_DIR} mtlSubinfo)
	set(CurrentRevision ${mtlSubinfo_WC_REVISION})
#       message("current revision: ${mtlSubinfo_WC_REVISION}")
else(Subversion_FOUND)
	set(CurrentRevision "0")
endif(Subversion_FOUND)
Naumann, Andreas's avatar
Naumann, Andreas committed
322
set(CPACK_PACKAGE_NAME "AMDiS")
323
set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de")
324
set(CPACK_PACKAGE_VERSION "0.9.${CurrentRevision}")
325
326
327
328
set(CPACK_GENERATOR "RPM" "DEB" "TGZ")
set(CPACK_INSTALL_PREFIX "/usr/")

set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= 1.42, ${RPM_DEPEND_STR}")
Naumann, Andreas's avatar
Naumann, Andreas committed
329
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.42)")
330
include(CPack)
Naumann, Andreas's avatar
Naumann, Andreas committed
331
if(ENABLE_TESTS)
332
333
ENABLE_TESTING()
add_subdirectory(test)
Naumann, Andreas's avatar
Naumann, Andreas committed
334
endif(ENABLE_TESTS)