AMDISUse.cmake 2.49 KB
Newer Older
1 2 3 4 5 6 7 8
#load mpi-compiler for use with parmetis and parallel_domain
if(AMDIS_HAS_PARALLEL_DOMAIN)
	find_package(MPI REQUIRED)
	if(MPI_FOUND)
		list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
		list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
		list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
	endif(MPI_FOUND)
Thomas Witkowski's avatar
Thomas Witkowski committed
9
	if(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PETSC")		
10 11 12 13 14 15 16
		set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMDIS_DIR})
		set(PETSC_EXECUTABLE_RUNS ON)
		find_package(PETSc REQUIRED)
		if(PETSC_FOUND)
			list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES})
			list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES})
		else()
Naumann, Andreas's avatar
Naumann, Andreas committed
17
			message(FATAL_ERROR "Could not find PETSc!")
18 19 20 21
		endif(PETSC_FOUND)
	elseif(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PMTL")
		find_package(MTL REQUIRED)
		list(APPEND AMDIS_LIBRARIES ${MTL_LIBRARIES})
Naumann, Andreas's avatar
Naumann, Andreas committed
22 23 24 25
		find_library(PARMETIS_LIB parmetis)
		if(PARMETIS_LIB)
			list(APPEND AMDIS_LIBRARIES ${PARMETIS_LIB})
		else(PARMETIS_LIB)
Naumann, Andreas's avatar
Naumann, Andreas committed
26
			message(FATAL_ERROR "could not find the parmetis libraries needed by amdis")
Naumann, Andreas's avatar
Naumann, Andreas committed
27
		endif(PARMETIS_LIB)
Naumann, Andreas's avatar
Naumann, Andreas committed
28 29 30 31 32 33
		find_library(METIS_LIB metis)
		if(METIS_LIB)
			list(APPEND AMDIS_LIBRARIES ${METIS_LIB})
		else(METIS_LIB)
			message(FATAL_ERROR "could not find the metis libraries needed by amdis")
		endif(METIS_LIB)
34
	endif()
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
	
elseif(AMDIS_NEED_PETSC)
    find_package(MPI REQUIRED)
    if(MPI_FOUND)
	    list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
	    list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
	    list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
    endif(MPI_FOUND)
	
  set(CMAKE_MODULE_PATH ${AMDIS_DIR})
    set(PETSC_EXECUTABLE_RUNS ON)
    find_package(PETSc REQUIRED)
    if(PETSC_FOUND)
	    list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES})
	    list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES})
    else()
	    message(FATAL_ERROR "Could not find PETSc!")
    endif(PETSC_FOUND)
endif()

if(AMDIS_NEED_HYPRE)
  find_package(HYPRE REQUIRED)
  if(HAVE_HYPRE)
    if(NOT MPI_FOUND)
      find_package(MPI REQUIRED)
      if(MPI_FOUND)
	    list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
	    list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
	    list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
      endif()
    endif()
    list(APPEND AMDIS_INCLUDE_DIRS ${HYPRE_INCLUDE_DIRECTORIES})
    list(APPEND AMDIS_COMPILEFLAGS "-DMTL_HAS_HYPRE")
    list(APPEND AMDIS_LIBRARIES ${HYPRE_LIBRARIES} )
  endif()
endif(AMDIS_NEED_HYPRE)
71 72 73 74 75

#thats bad because it affects each target
add_definitions(${AMDIS_COMPILEFLAGS})
include_directories(${AMDIS_INCLUDE_DIRS})