Skip to content
Snippets Groups Projects
AMDISConfig.cmake.in 5.21 KiB
Newer Older
  • Learn to ignore specific revisions
  • #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
    # 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
    # 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 )
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    # include(${AMDIS_USE_FILE})
    
    # add_executable(yourTarget <yourSources>)
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    # target_link_libraries(yourTarget ${AMDIS_LIBRARIES})
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    #The AMDIS_USE_FILE adds the include and link-directories for amdis to cmake.
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    #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
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    #and omit the AMDIS_USE_FILE. Then you also have to set the flags, include 
    
    ################## 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()
    ##################################################################
    
    #try to detect the AMDiS include directory
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    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
    	set(AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR})
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    	message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    unset(_AMDIS_H CACHE)
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    set(MTL_DIR ${AMDIS_INCLUDE_DIR}/mtl4 CACHE PATH "the mtl directory")
    list(APPEND AMDIS_INCLUDE_DIRS ${MTL_DIR})
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    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
    	set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR})
    
    	set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libcompositeFEM.so;${AMDIS_LIBRARY_DIR}/libreinit.so;${AMDIS_LIBRARY_DIR}/libmuparser.so" CACHE STRING "amdis libraries")
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    	message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library")
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    unset(_AMDIS_LIB CACHE)
    
    find_package(Boost 1.42 REQUIRED system iostreams filesystem)
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    	list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES})
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    	list(APPEND AMDIS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    	list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
    
    set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
    set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
    set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
    
    set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
    
    set(AMDIS_NEED_MKL @ENABLE_MKL@)
    set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
    set(AMDIS_COMPILEFLAGS "@COMPILEFLAGS@")
    
    set(AMDIS_VERSION @CurrentRevision@)
    set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@)
    set(AMDIS_MINOR_VERSION @AMDIS_MINOR@)
    
    	set(AMDIS_UMFPACK_PATH @UMFPACK_PATH@)
    	list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_UMFPACK_PATH})
    
    
    	find_library(UMFPACK_LIB umfpack
    
    		HINTS ENV LIBRARY_PATH
    		DOC "The UMFPACK library")
    	if(UMFPACK_LIB)
    
    		list(APPEND AMDIS_LIBRARIES ${UMFPACK_LIB})
    	else()
    
    		message(FATAL_ERROR "Could not find the UMFPACK library")
    
    	find_library(BLAS_LIBRARY NAMES "blas" "goto" "mkl"
    		HINTS ENV MKL_LIB
    		DOC "The BLAS library")
    	if(BLAS_LIBRARY)
    		list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARY})
    		list(APPEND AMDIS_LIBRARY_DIRS ${BLAS_LIBRARY_DIR})
    	else()
    		message(ERROR "Could not find the BLAS library. Please set the variable BLAS_LIBRARY to the blas library with full path")
    	endif()
    
    
    		HINTS ENV LIBRARY_PATH
    		DOC "The AMD library")
    	if(AMD_LIB)
    
    		list(APPEND AMDIS_LIBRARIES ${AMD_LIB})
    	else()
    
    		message(FATAL_ERROR "Could not find the AMD library.")
    
    endif(AMDIS_NEED_UMFPACK)
    
    if(AMDIS_NEED_BDDCML)
    	set(AMDIS_BDDCML_PATH @BDDCML_PATH@)
    	list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_BDDCML_PATH})
    
    	set(AMDIS_BDDCML_LIB @BDDCML_LIB@)
    	list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LIB})
    
    
    	set(AMDIS_BDDCML_LINK_LIST @BDDCML_LINK_LIST@)
    	list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LINK_LIST})
    
    endif(AMDIS_NEED_BDDCML)
    
    
    Praetorius, Simon's avatar
    Praetorius, Simon committed
    
    #add directories for reinit
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM)
    
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
    
    Naumann, Andreas's avatar
    Naumann, Andreas committed
    if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack )
    
    	if(NOT AMDIS_NEED_UMFPACK)
    	  set(AMDIS_umfpack_FOUND FALSE)
    	  message(SEND_ERROR "The selected amdis was not compiled with umfpack")
    
    	find_library(ZOLTAN_LIB zoltan 
    		HINTS ENV LIBRARY_PATH
    		DOC "full path to the zoltan library")		
    
    	if(ZOLTAN_LIB)
    		list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB})	
    	else()
    		message(FATAL_ERROR "Could not find zoltan library!")
    	endif()