AMDiSConfig.cmake.in 4.23 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#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:
# AMDiS_INCLUDE_DIR 	the amdis-directory only
# AMDiS_INCLUDE_DIRS	all include directories (mtl, umfpack, parmetis, metis, ...)
# AMDiS_LIBRARIES	the needed libraries
# AMDiS_LIBRARY_DIRS	the link directories
# 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 )
# include(${AMDiS_USE_FILE})
# add_executable(yourTarget <yourSources>)
# target_link_libraries(yourTarget ${AMDiS_LIBRARIES})
#
#
#The AMDiS_USE_FILE adds the include and link-directories for amdis to cmake.
# 
#If you use the parallel amdis-version, the AMDiS_USE_FILE also trys to detect
#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
#and omit the AMDiS_USE_FILE. Then you also have to set the flags, include 
#and library directories.


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#try to detect the AMDiS include directory
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)
	set(AMDiS_INCLUDE_DIRS ${AMDiS_INCLUDE_DIR})
else()
	message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDiS_INCLUDE_DIR to the directory containing the AMDiS headers.")
endif()
unset(_AMDiS_H CACHE)
set(MTL_DIR ${AMDiS_INCLUDE_DIR}/mtl4 CACHE PATH "the mtl directory")
list(APPEND AMDiS_INCLUDE_DIRS ${MTL_DIR})

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)
	set(AMDiS_LIBRARY_DIRS ${AMDiS_LIBRARY_DIR})
44
	set(AMDiS_LIBRARIES "${_AMDiS_LIB};${AMDiS_LIBRARY_DIR}/libcompositeFEM.so" CACHE STRING "amdis libraries")
45
46
47
48
49
else()
	message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDiS_LIBRARY_DIR to the directory containg the AMDiS library")
endif()
unset(_AMDiS_LIB CACHE)

50
find_package(Boost 1.42 REQUIRED system iostreams)
51
if(Boost_FOUND)
52
53
54
	list(APPEND AMDiS_LIBRARIES ${Boost_LIBRARIES})
	list(APPEND AMDiS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
	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@)
62
set(AMDiS_USE_FILE ${AMDiS_DIR}/AMDiSUse.cmake)
63
set(AMDiS_COMPILEFLAGS "@COMPILEFLAGS@")
64

Naumann, Andreas's avatar
Naumann, Andreas committed
65
if(AMDiS_NEED_UMFPACK)
66
67
68
	set(BLAS_LIBRARY "blas" CACHE FILEPATH "the blas library")
	find_library(_BLAS_LIB NAMES "${BLAS_LIBRARY}" "goto" PATHS ${BLAS_LIBRARY_DIR})
	message("blaslibrary: ${_BLAS_LIB}")
69
	if(NOT _BLAS_LIB)
70
71
72
		message(ERROR " could not find the blas library. please set the variable BLAS_LIBRARY to the blas library with full path")
	else()
		set(BLAS_LIBRARY "${_BLAS_LIB}")
73
	endif()
74
	list(APPEND AMDiS_LIBRARIES ${AMDiS_LIBRARY_DIR}/umfpack/libumfpack.a ${AMDiS_LIBRARY_DIR}/amd/libamd.a ${BLAS_LIBRARY})
75
76
77
78
79
80
	list(APPEND AMDiS_LIBRARY_DIRS ${AMDiS_LIBRARY_DIR}/umfpack ${AMDiS_LIBRARY_DIR}/amd ${BLAS_LIBRARY_DIR})
	list(APPEND AMDiS_INCLUDE_DIRS 
		${AMDiS_INCLUDE_DIR}/umfpack  
		${AMDiS_INCLUDE_DIR}/amd
		${AMDiS_INCLUDE_DIR}/ufconfig
		${AMDiS_INCLUDE_DIR}/ufconfig/xerbla
81
	)
Naumann, Andreas's avatar
Naumann, Andreas committed
82
endif(AMDiS_NEED_UMFPACK)
83

84
if(${AMDiS_FIND_COMPONENTS} MATCHES umfpack )
85
	if( NOT AMDiS_NEED_UMFPACK )
86
87
88
89
90
	  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
91
if( AMDiS_NEED_PARMETIS )
92
  list(APPEND AMDiS_LIBRARY_DIRS ${AMDiS_LIBRARY_DIR}/parmetis)
93
  list(APPEND AMDiS_LIBRARIES ${AMDiS_LIBRARY_DIR}/parmetis/libparmetis.a ${AMDiS_LIBRARY_DIR}/parmetis/libmetis.a)
94
95
endif()

96
97
98
99
if( AMDiS_NEED_ZOLTAN )
  find_library(ZOLTAN_LIB zoltan DOC "full path to the zoltan library")
  list(APPEND AMDiS_LIBRARIES ${ZOLTAN_LIB})
endif()
100
if(${AMDiS_FIND_COMPONENTS} MATCHES parmetis AND NOT AMDiS_NEED_PARMETIS)
101
102
	message(SEND_ERROR "amdis was not compiled with parmetis")
endif()