Commit dafec6cd authored by Markus Blatt's avatar Markus Blatt

[release] Find ParMETIS even if it is actually the static PT-Scotch library.

The PT-Scotch library on Debian is rather broken. There are several libraries
missing for the version with long, int32, int64 support. If one
wants to use them, then one needs to use the static libraries and provide
the correct library with the parmetis bindings. Unfortunately, our ParMETIS test
assumes that the library is self contained which breaks on Debian Jessie.
This commit fixes this. If parmetis_v3_partkway is not found with the ParMETIS
library alone then we try to find the corresponding PT-Scotch helper libraries
and try to find the function again.
parent 6cb3992f
......@@ -94,11 +94,29 @@ if(PARMETIS_FOUND)
NO_DEFAULT_PATH)
find_library(PARMETIS_LIBRARY parmetis)
set(_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") # do a backup
# check ParMETIS library
if(PARMETIS_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARY} ${MPI_DUNE_LIBRARIES})
set(_PARMETIS_LIBRARY ${METIS_LIBRARIES} ${MPI_DUNE_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${_PARMETIS_LIBRARIES} ${_CMAKE_REQUIRED_LIBRARIES})
include(CheckFunctionExists)
check_function_exists(parmetis_v3_partkway HAVE_PARMETIS)
if(NOT HAVE_PARMETIS)
# Maybe we are using static scotch libraries. In this case we need to link
# the other scotch libraries too. Let's make a best effort.
# Get the path eher METIS_LIBRARY resides
get_filename_component(_lib_root ${METIS_LIBRARY} DIRECTORY)
find_library(PTSCOTCH_LIBRARY ptscotch PATHS ${_lib_root} "The PT-Scotch library.")
find_library(PTSCOTCHERR_LIBRARY ptscotcherr PATHS ${_lib_root} "The Scotch error library.")
if(PTSCOTCH_LIBRARY AND PTSCOTCHERR_LIBRARY)
set(_PARMETIS_LIBRARIES ${PARMETIS_LIBRARY} ${PTSCOTCH_LIBRARY}
${PTSCOTCHERR_LIBRARY} ${METIS_LIBRARIES} ${MPI_DUNE_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${_PARMETIS_LIBRARIES}
${CMAKE_REQUIRED_LIBRARIES})
unset(HAVE_PARMETIS CACHE)
check_function_exists(parmetis_v3_partkway HAVE_PARMETIS)
endif()
endif()
endif(PARMETIS_LIBRARY)
endif(PARMETIS_FOUND)
......@@ -119,7 +137,7 @@ cmake_pop_check_state()
if(PARMETIS_FOUND)
set(PARMETIS_INCLUDE_DIRS ${PARMETIS_INCLUDE_DIR})
set(PARMETIS_LIBRARIES "${PARMETIS_LIBRARY};${METIS_LIBRARY};${MPI_DUNE_LIBRARIES}"
set(PARMETIS_LIBRARIES "${_PARMETIS_LIBRARIES}"
CACHE FILEPATH "ParMETIS libraries needed for linking")
set(PARMETIS_LINK_FLAGS "${DUNE_MPI_LINK_FLAGS}"
CACHE STRING "ParMETIS link flags")
......
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