AMDISConfig.cmake.in 5.7 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
#and library directories.

27 28 29 30 31
################## ONLY WORKAROUND AND WARNING ###################
if(NOT "$ENV{LIBRARY_PATH}" STREQUAL "")
        message(WARNING "the environment variable LIBRARY_PATH is set. this can lead to problems during linking. \n You can unset it in your CMakeLists.txt with the command unset(ENV{LIBRARY_PATH}).\n")
endif()
##################################################################
32
#try to detect the AMDiS include directory
Naumann, Andreas's avatar
Naumann, Andreas committed
33 34 35
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
36
	set(AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR})
37
else()
Naumann, Andreas's avatar
Naumann, Andreas committed
38
	message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
39
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
40
unset(_AMDIS_H CACHE)
Naumann, Andreas's avatar
Naumann, Andreas committed
41 42
set(MTL_DIR ${AMDIS_INCLUDE_DIR}/mtl4 CACHE PATH "the mtl directory")
list(APPEND AMDIS_INCLUDE_DIRS ${MTL_DIR})
43

Naumann, Andreas's avatar
Naumann, Andreas committed
44 45 46
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
47
	set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR})
48
	set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libcompositeFEM.so;${AMDIS_LIBRARY_DIR}/libreinit.so;${AMDIS_LIBRARY_DIR}/libmuparser.so" CACHE STRING "amdis libraries")
49
else()
Naumann, Andreas's avatar
Naumann, Andreas committed
50
	message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library")
51
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
52
unset(_AMDIS_LIB CACHE)
53

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

61 62 63 64 65 66
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_MKL @ENABLE_MKL@)
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
set(AMDIS_COMPILEFLAGS "@COMPILEFLAGS@")
67 68 69
set(AMDIS_VERSION @CurrentRevision@)
set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@)
set(AMDIS_MINOR_VERSION @AMDIS_MINOR@)
70

71
if(AMDIS_NEED_UMFPACK)
72 73
	#look for umfpack, we need the headers only
	find_file(UMFPACK_H umfpack.h
Praetorius, Simon's avatar
Praetorius, Simon committed
74
			HINTS /usr/include /usr/include/suitesparse /usr/include/ufsparse
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 102 103 104
			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
105
#	message("blaslibrary: ${BLAS_LIBRARY}")
106 107 108
	if( BLAS_LIBRARY )
		list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARY})
	else()
109
		message(ERROR " could not find the blas library. please set the variable BLAS_LIBRARY to the blas library with full path")
110
	endif()
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128

	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})
129
endif(AMDIS_NEED_UMFPACK)
130

Praetorius, Simon's avatar
Praetorius, Simon committed
131 132 133 134

#add directories for reinit
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM)
135
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
Praetorius, Simon's avatar
Praetorius, Simon committed
136

Naumann, Andreas's avatar
Naumann, Andreas committed
137
if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack )
138 139
	if( NOT AMDIS_NEED_UMFPACK )
	  set( AMDIS_umfpack_FOUND FALSE)
140 141 142 143
	  message(SEND_ERROR "the selected amdis was not compiled with umfpack")
	endif()
endif()

144
if(AMDIS_NEED_ZOLTAN)
145
  find_library(ZOLTAN_LIB zoltan DOC "full path to the zoltan library")
Naumann, Andreas's avatar
Naumann, Andreas committed
146
  list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB})
147
endif()