From b47043e6845e958e170d0bc974deab4afd42cff2 Mon Sep 17 00:00:00 2001 From: maier Date: Sun, 16 Sep 2012 20:09:26 +0000 Subject: [PATCH] Complete metis support git-svn-id: https://svn.dealii.org/branches/branch_cmake@26421 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/configure/configure_metis.cmake | 9 +- deal.II/contrib/cmake/modules/FindMETIS.cmake | 13 +++ deal.II/features.m4 | 88 ------------------- 3 files changed, 20 insertions(+), 90 deletions(-) diff --git a/deal.II/contrib/cmake/configure/configure_metis.cmake b/deal.II/contrib/cmake/configure/configure_metis.cmake index f749799032..c7f8e24177 100644 --- a/deal.II/contrib/cmake/configure/configure_metis.cmake +++ b/deal.II/contrib/cmake/configure/configure_metis.cmake @@ -6,8 +6,13 @@ MACRO(FIND_FEATURE_METIS_EXTERNAL var) FIND_PACKAGE(METIS) - IF(METIS_FOUND) + IF(METIS_FOUND AND METIS_MAJOR GREATER 4) SET(${var} TRUE) + ELSE() + MESSAGE(STATUS + "Could not find a sufficient modern metis installation: Version 5.x + required." + ) ENDIF() ENDMACRO() @@ -29,7 +34,7 @@ MACRO(CONFIGURE_FEATURE_METIS_ERROR_MESSAGE) MESSAGE(SEND_ERROR " Could not find the metis library! -Please ensure that the metis library is installed on your computer. +Please ensure that the metis version 5.x is installed on your computer. If the library is not at a default location, either provide some hints via environment variables: METIS_LIBRARY_DIR METIS_INCLUDE_DIR diff --git a/deal.II/contrib/cmake/modules/FindMETIS.cmake b/deal.II/contrib/cmake/modules/FindMETIS.cmake index fec10fad51..1ea0c7d782 100644 --- a/deal.II/contrib/cmake/modules/FindMETIS.cmake +++ b/deal.II/contrib/cmake/modules/FindMETIS.cmake @@ -15,6 +15,19 @@ FIND_LIBRARY(METIS_LIBRARY PATH_SUFFIXES lib64 lib ) +# +# Extract the version number out of metis.h +# + +FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" METIS_MAJOR_STRING + REGEX "METIS_VER_MAJOR") +STRING(REGEX REPLACE "^.*METIS_VER_MAJOR.* ([0-9]+).*" "\\1" METIS_MAJOR "${METIS_MAJOR_STRING}") + +FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" METIS_MINOR_STRING + REGEX "METIS_VER_MINOR") +STRING(REGEX REPLACE "^.*METIS_VER_MINOR.* ([0-9]+).*" "\\1" METIS_MINOR "${METIS_MINOR_STRING}") + + FIND_PACKAGE_HANDLE_STANDARD_ARGS(METIS DEFAULT_MSG METIS_LIBRARY METIS_INCLUDE_DIR) IF(METIS_FOUND) diff --git a/deal.II/features.m4 b/deal.II/features.m4 index 45c81c8ef0..fae309429b 100644 --- a/deal.II/features.m4 +++ b/deal.II/features.m4 @@ -1352,94 +1352,6 @@ AC_DEFUN(DEAL_II_CONFIGURE_ARPACK, dnl ]) -dnl ------------------------------------------------------------ -dnl Check whether Metis is installed, and if so store the -dnl respective links -dnl -dnl Usage: DEAL_II_CONFIGURE_METIS -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_METIS, dnl -[ - dnl First check for the Metis directory - - AC_ARG_WITH(metis, - [AS_HELP_STRING([--with-metis=/path/to/metis], - [Specify the path to the Metis installation, of which the include and library directories are subdirs; use this if you want to override the METIS_DIR environment variable.])], - [ - AC_MSG_CHECKING([for METIS library directory]) - USE_CONTRIB_METIS=yes - DEAL_II_METIS_DIR="$withval" - AC_MSG_RESULT($DEAL_II_METIS_DIR) - - dnl Make sure that what was specified is actually correct. The - dnl libraries could be in either $DEAL_II_METIS_DIR/lib (metis was - dnl make installed) or $DEAL_II_METIS_DIR/libmetis (metis was make - dnl only and PETSc). - if test ! -d $DEAL_II_METIS_DIR/lib \ - && test ! -d $DEAL_II_METIS_DIR/libmetis ; then - AC_MSG_ERROR([Path to Metis specified with --with-metis does not point to a complete Metis installation]) - fi - - dnl If lib is not found, we must have libraries in libmetis - dnl (which was found above). - if test -d $DEAL_II_METIS_DIR/lib ; then - DEAL_II_METIS_LIBDIR="$DEAL_II_METIS_DIR/lib" - else - DEAL_II_METIS_LIBDIR="$DEAL_II_METIS_DIR/libmetis" - fi - - if test ! -d $DEAL_II_METIS_DIR/include ; then - AC_MSG_ERROR([Path to Metis specified with --with-metis does not point to a complete Metis installation]) - fi - - DEAL_II_METIS_INCDIR="$DEAL_II_METIS_DIR/include" - ], - [ - dnl Take something from the environment variables, if it is there - if test "x$METIS_DIR" != "x" ; then - AC_MSG_CHECKING([for METIS from the environment]) - USE_CONTRIB_METIS=yes - DEAL_II_METIS_DIR="$METIS_DIR" - AC_MSG_RESULT($DEAL_II_METIS_DIR) - - dnl Make sure that what this is actually correct (see notes above). - if test ! -d $DEAL_II_METIS_DIR/lib \ - && test ! -d $DEAL_II_METIS_DIR/libmetis ; then - AC_MSG_ERROR([The path to Metis specified in the METIS_DIR environment variable does not point to a complete Metis installation]) - fi - - if test -d $DEAL_II_METIS_DIR/lib ; then - DEAL_II_METIS_LIBDIR="$DEAL_II_METIS_DIR/lib" - else - DEAL_II_METIS_LIBDIR="$DEAL_II_METIS_DIR/libmetis" - fi - - DEAL_II_METIS_INCDIR="$DEAL_II_METIS_DIR/include" - - else - USE_CONTRIB_METIS=no - DEAL_II_METIS_DIR="" - fi - ]) - - if test "x$USE_CONTRIB_METIS" = "xyes" ; then - AC_DEFINE(DEAL_II_USE_METIS, 1, - [Defined if a Metis installation was found and is going - to be used]) - LDFLAGS="$LDFLAGS -L$DEAL_II_METIS_LIBDIR -lmetis" - - if test "x$DEAL_II_LD_UNDERSTANDS_RPATH" = "xyes" ; then - LDFLAGS="$LDFLAGS $LD_PATH_OPTION$DEAL_II_METIS_LIBDIR" - fi - - dnl AC_MSG_CHECKING(for Metis version) - dnl DEAL_II_METIS_VERSION=`cat $DEAL_II_METIS_DIR/VERSION` - dnl AC_MSG_RESULT($DEAL_II_METIS_VERSION) - fi -]) - - dnl ------------------------------------------------------------ dnl Check whether P4EST is to be used to parallelize meshes dnl -- 2.39.5