AMDiSConfig.cmake.in 5.41 KB
Newer Older
1
2
3
#This configuration file is shipped with the great FEM-Toolbox AMDiS.
#It simplifies the configure of different amdis-version and sets some variables.
#We set the following variables:
Naumann, Andreas's avatar
Naumann, Andreas committed
4
5
6
# AMDIS_INCLUDE_DIR 	the amdis-directory only
# AMDIS_INCLUDE_DIRS	all include directories (mtl, umfpack, parmetis, metis, ...)
# AMDIS_LIBRARIES	the needed libraries
Naumann, Andreas's avatar
Naumann, Andreas committed
7
# AMDIS_LIBRARY_DIRS	the link directories
8
9
10
11
12
13
# AMDiS_COMPILEFLAGS	some compile flags for amdis
#
#
# For a fast start, you use this package in the following way
# simply look for it, possibly set the AMDiS directory
# find_package(AMDiS )
Naumann, Andreas's avatar
Naumann, Andreas committed
14
# include(${AMDIS_USE_FILE})
15
# add_executable(yourTarget <yourSources>)
Naumann, Andreas's avatar
Naumann, Andreas committed
16
# target_link_libraries(yourTarget ${AMDIS_LIBRARIES})
17
18
#
#
Naumann, Andreas's avatar
Naumann, Andreas committed
19
#The AMDIS_USE_FILE adds the include and link-directories for amdis to cmake.
20
# 
Naumann, Andreas's avatar
Naumann, Andreas committed
21
#If you use the parallel amdis-version, the AMDIS_USE_FILE also trys to detect
22
23
#the mpi and petsc configuration. If those versions don't fit your needs,
#you can change the corresponding directories, or simply do this work at your own
Naumann, Andreas's avatar
Naumann, Andreas committed
24
#and omit the AMDIS_USE_FILE. Then you also have to set the flags, include 
25
26
27
#and library directories.


28
#try to detect the AMDiS include directory
Naumann, Andreas's avatar
Naumann, Andreas committed
29
30
31
find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_INCLUDE_DIR} ${AMDIS_DIR}/../../include/amdis/ /usr/include/amdis/)
if(_AMDIS_H)
	get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE)
Naumann, Andreas's avatar
Naumann, Andreas committed
32
	set(AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR})
33
else()
Naumann, Andreas's avatar
Naumann, Andreas committed
34
	message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
35
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
36
unset(_AMDIS_H CACHE)
Naumann, Andreas's avatar
Naumann, Andreas committed
37
38
set(MTL_DIR ${AMDIS_INCLUDE_DIR}/mtl4 CACHE PATH "the mtl directory")
list(APPEND AMDIS_INCLUDE_DIRS ${MTL_DIR})
39

Naumann, Andreas's avatar
Naumann, Andreas committed
40
41
42
find_library(_AMDIS_LIB amdis PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/ /usr/include/amdis)
if(_AMDIS_LIB)
	get_filename_component(AMDIS_LIBRARY_DIR ${_AMDIS_LIB} PATH CACHE)
Naumann, Andreas's avatar
Naumann, Andreas committed
43
	set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR})
Naumann, Andreas's avatar
Naumann, Andreas committed
44
	set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libcompositeFEM.so" CACHE STRING "amdis libraries")
45
else()
Naumann, Andreas's avatar
Naumann, Andreas committed
46
	message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library")
47
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
48
unset(_AMDIS_LIB CACHE)
49

50
find_package(Boost 1.42 REQUIRED system iostreams filesystem)
51
if(Boost_FOUND)
Naumann, Andreas's avatar
Naumann, Andreas committed
52
	list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES})
Naumann, Andreas's avatar
Naumann, Andreas committed
53
	list(APPEND AMDIS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
Naumann, Andreas's avatar
Naumann, Andreas committed
54
	list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
55
endif(Boost_FOUND)
56

Naumann, Andreas's avatar
Naumann, Andreas committed
57
set(AMDiS_NEED_PARMETIS @ENABLE_PARMETIS@)
58
set(AMDiS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
Naumann, Andreas's avatar
Naumann, Andreas committed
59
60
61
set(AMDiS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDiS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDiS_NEED_MKL @ENABLE_MKL@)
Naumann, Andreas's avatar
Naumann, Andreas committed
62
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDiSUse.cmake)
63
set(AMDiS_COMPILEFLAGS "@COMPILEFLAGS@")
64
65
66
set(AMDIS_VERSION @CurrentRevision@)
set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@)
set(AMDIS_MINOR_VERSION @AMDIS_MINOR@)
67

Naumann, Andreas's avatar
Naumann, Andreas committed
68
if(AMDiS_NEED_UMFPACK)
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
	#look for umfpack, we need the headers only
	find_file(UMFPACK_H umfpack.h
			HINTS /usr/include /usr/include/suitesparse 
			DOC "headerfile umfpack.h for UMFPACK")
	if( UMFPACK_H )
		#construct the include path
		get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
		#look for ufconfig
		find_file(UFCONFIG_H UFconfig.h
				HINTS /usr/include ${UMFPACK_PATH}
				DOC "headerfile UFConfig.h")
		if( UFCONFIG_H )
			get_filename_component(UFCONFIG_PATH ${UFCONFIG_H} PATH)
		else()
			message(FATAL_ERROR "could not find UFConfig.h, needed for umfpack")
		endif()
		#look for amd
		find_file(AMD_H amd.h
				HINTS /usr/include/ ${UMFPACK_PATH}
				DOC "headerfile amd.h")
		if( AMD_H )
			get_filename_component(AMD_PATH ${AMD_H} PATH)
		else()
			message( FATAL_ERROR "could not find amd.h, needed for umfpack")
		endif()
	
		#add the compileflags and directories
		list(APPEND AMDIS_INCLUDE_DIRS ${UMFPACK_PATH} ${UFCONFIG_PATH} ${AMD_PATH})
	else()
		message(FATAL_ERROR "Could not find the umfpack-headers. Please install umfpack")
	endif()
	find_library(BLAS_LIBRARY NAMES "blas" "goto"
			DOC "the blas library")
Naumann, Andreas's avatar
Naumann, Andreas committed
102
#	message("blaslibrary: ${BLAS_LIBRARY}")
103
104
105
	if( BLAS_LIBRARY )
		list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARY})
	else()
106
		message(ERROR " could not find the blas library. please set the variable BLAS_LIBRARY to the blas library with full path")
107
	endif()
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

	find_library(UMFPACK_LIB umfpack
			DOC "the UMFPACK library")
	if( UMFPACK_LIB )
		list(APPEND AMDIS_LIBRARIES ${UMFPACK_LIB})
	else()
		message(FATAL_ERROR "Did not find the umfpack library")
	endif()
	
	find_library(AMD_LIB amd
			DOC "the AMD library")
	if( AMD_LIB )
		list(APPEND AMDIS_LIBRARIES ${AMD_LIB})
	else()
		message(FATAL_ERROR "Did not find the amd library")
	endif()
	#message("amdis-libs: ${AMDIS_LIBRARIES}")
	list(APPEND AMDIS_LIBRARY_DIRS ${BLAS_LIBRARY_DIR})
Naumann, Andreas's avatar
Naumann, Andreas committed
126
endif(AMDiS_NEED_UMFPACK)
127

Naumann, Andreas's avatar
Naumann, Andreas committed
128
if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack )
129
	if( NOT AMDiS_NEED_UMFPACK )
130
131
132
133
134
	  set( AMDiS_umfpack_FOUND FALSE)
	  message(SEND_ERROR "the selected amdis was not compiled with umfpack")
	endif()
endif()

Naumann, Andreas's avatar
Naumann, Andreas committed
135
if( AMDiS_NEED_PARMETIS )
Naumann, Andreas's avatar
Naumann, Andreas committed
136
  list(APPEND AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR}/parmetis)
Naumann, Andreas's avatar
Naumann, Andreas committed
137
  list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/parmetis/libparmetis.a ${AMDIS_LIBRARY_DIR}/parmetis/libmetis.a)
138
139
endif()

140
141
if( AMDiS_NEED_ZOLTAN )
  find_library(ZOLTAN_LIB zoltan DOC "full path to the zoltan library")
Naumann, Andreas's avatar
Naumann, Andreas committed
142
  list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB})
143
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
144
if(${AMDIS_FIND_COMPONENTS} MATCHES parmetis AND NOT AMDiS_NEED_PARMETIS)
145
146
	message(SEND_ERROR "amdis was not compiled with parmetis")
endif()