Commit 941d28f2 authored by Praetorius, Simon's avatar Praetorius, Simon

petsc and zoltan configuration updated

parent 14b8a30c
macro(target_enable_mpi _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
find_package(MPI REQUIRED)
target_include_directories(${_TARGET_} ${_SCOPE_}
${MPI_CXX_INCLUDE_PATH})
target_compile_options(${_TARGET_} ${_SCOPE_}
${MPI_CXX_COMPILE_FLAGS})
string(STRIP " ${MPI_CXX_LINK_FLAGS} " MPI_CXX_LINK_FLAGS_)
if (LINK_EXECUTABLE)
target_link_libraries(${_TARGET_} ${_SCOPE_}
${MPI_CXX_LINK_FLAGS_} ${MPI_CXX_LIBRARIES})
endif (LINK_EXECUTABLE)
endmacro(target_enable_mpi)
macro(target_enable_petsc _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON)
......@@ -41,6 +51,17 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
set(PETSC_DEFINITIONS ${PETSC_CFLAGS} ${PETSC_CFLAGS_OTHER})
endif (PETSc_FOUND)
target_include_directories(${_TARGET_} ${_SCOPE_} ${PETSC_INCLUDE_DIRS})
target_compile_definitions(${_TARGET_} ${_SCOPE_}
HAVE_PARALLEL_PETSC=1
PETSC_VERSION=${PETSC_VERSION})
target_compile_options(${_TARGET_} ${_SCOPE_} ${PETSC_DEFINITIONS})
if (LINK_EXECUTABLE)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LIBRARIES})
endif (LINK_EXECUTABLE)
# parmetis is required
find_file(PARMETIS_HEADER_FILE "parmetis.h"
HINTS ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS})
......@@ -54,13 +75,13 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
if (LINK_EXECUTABLE)
find_library(PARMETIS_LIB parmetis
HINTS ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS})
if (PARMETIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PARMETIS_LIB})
else (PARMETIS_LIB)
if (NOT PARMETIS_LIB)
message(FATAL_ERROR "Could not find the ParMetis libraries needed by amdis")
endif (PARMETIS_LIB)
endif (NOT PARMETIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PARMETIS_LIB})
endif (LINK_EXECUTABLE)
# metis is required
find_file(METIS_HEADER_FILE "metis.h"
HINTS ${METIS_DIR}/include ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS})
......@@ -74,14 +95,15 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
if (LINK_EXECUTABLE)
find_library(METIS_LIB metis
HINTS ${METIS_DIR}/lib ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS})
if (METIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${METIS_LIB})
else (METIS_LIB)
if (NOT METIS_LIB)
message(FATAL_ERROR "Could not find the MEtis libraries needed by amdis")
endif (METIS_LIB)
endif (NOT METIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${METIS_LIB})
endif (LINK_EXECUTABLE)
# blas library is required
if (LINK_EXECUTABLE)
find_library(BLAS_LIB
NAMES blas fblas openblas
HINTS ${BLAS_DIR}/lib ${PETSC_LIBRARY_DIRS} /usr/lib/openblas-base /usr/lib/atlas-base)
......@@ -90,8 +112,12 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
else (BLAS_LIB)
find_package(BLAS REQUIRED)
endif (BLAS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${BLAS_LIBRARIES})
endif (LINK_EXECUTABLE)
# lapack library is required
if (LINK_EXECUTABLE)
find_library(LAPACK_LIB
NAMES lapack flapack
HINTS ${LAPACK_DIR}/lib ${PETSC_LIBRARY_DIRS} ${PETSC_DIR}/lib)
......@@ -100,11 +126,6 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
else (LAPACK_LIB)
find_package(LAPACK REQUIRED)
endif (LAPACK_LIB)
target_include_directories(${_TARGET_} ${_SCOPE_} ${PETSC_INCLUDE_DIRS})
target_compile_definitions(${_TARGET_} ${_SCOPE_}
HAVE_PARALLEL_PETSC=1
PETSC_VERSION=${PETSC_VERSION})
target_compile_options(${_TARGET_} ${_SCOPE_} ${PETSC_DEFINITIONS})
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries(${_TARGET_} ${_SCOPE_} ${LAPACK_LIBRARIES})
endif (LINK_EXECUTABLE)
endmacro(target_enable_petsc)
......@@ -18,10 +18,9 @@ macro(target_enable_zoltan _TARGET_ _SCOPE_)
if (LINK_EXECUTABLE)
find_library(ZOLTAN_LIB zoltan
HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library")
if (ZOLTAN_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${ZOLTAN_LIB})
else()
if (NOT ZOLTAN_LIB)
message(FATAL_ERROR "Could not find zoltan library!")
endif()
endif (NOT ZOLTAN_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${ZOLTAN_LIB})
endif (LINK_EXECUTABLE)
endmacro(target_enable_zoltan)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment