From ec4b66142c81dea879d5a85d0b44ee4ee4b2f4e3 Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 27 May 2014 11:40:22 +0000 Subject: [PATCH] Revert "CMake: Bugfix: Disable MPI check. This was a bad idea." and resolve symlinks completely git-svn-id: https://svn.dealii.org/trunk@32981 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/configure/configure_2_metis.cmake | 2 + .../configure/configure_2_trilinos.cmake | 2 + .../cmake/configure/configure_3_petsc.cmake | 2 + deal.II/cmake/configure/configure_hdf5.cmake | 2 + deal.II/cmake/configure/configure_mumps.cmake | 10 +++ deal.II/cmake/configure/configure_p4est.cmake | 2 + .../macros/macro_check_mpi_interface.cmake | 71 +++++++++++++++++++ 7 files changed, 91 insertions(+) create mode 100644 deal.II/cmake/macros/macro_check_mpi_interface.cmake diff --git a/deal.II/cmake/configure/configure_2_metis.cmake b/deal.II/cmake/configure/configure_2_metis.cmake index d5142a5432..4d499c0d60 100644 --- a/deal.II/cmake/configure/configure_2_metis.cmake +++ b/deal.II/cmake/configure/configure_2_metis.cmake @@ -36,6 +36,8 @@ MACRO(FEATURE_METIS_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + CHECK_MPI_INTERFACE(METIS ${var}) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_2_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake index aa7920e6b7..a79505384b 100644 --- a/deal.II/cmake/configure/configure_2_trilinos.cmake +++ b/deal.II/cmake/configure/configure_2_trilinos.cmake @@ -178,6 +178,8 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() ENDIF() + + CHECK_MPI_INTERFACE(TRILINOS ${var}) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_3_petsc.cmake b/deal.II/cmake/configure/configure_3_petsc.cmake index 19675f272c..662c30f8a3 100644 --- a/deal.II/cmake/configure/configure_3_petsc.cmake +++ b/deal.II/cmake/configure/configure_3_petsc.cmake @@ -93,6 +93,8 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + CHECK_MPI_INTERFACE(PETSC ${var}) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_hdf5.cmake b/deal.II/cmake/configure/configure_hdf5.cmake index 84ff9b6963..6a335a232c 100644 --- a/deal.II/cmake/configure/configure_hdf5.cmake +++ b/deal.II/cmake/configure/configure_hdf5.cmake @@ -40,6 +40,8 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + CHECK_MPI_INTERFACE(HDF5 ${var}) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake index 213d1d320a..ce1d2652b1 100644 --- a/deal.II/cmake/configure/configure_mumps.cmake +++ b/deal.II/cmake/configure/configure_mumps.cmake @@ -20,4 +20,14 @@ SET(FEATURE_MUMPS_DEPENDS MPI LAPACK) + +MACRO(FEATURE_MUMPS_FIND_EXTERNAL var) + FIND_PACKAGE(MUMPS) + + IF(MUMPS_FOUND) + SET(${var} TRUE) + CHECK_MPI_INTERFACE(MUMPS ${var}) + ENDIF() +ENDMACRO() + CONFIGURE_FEATURE(MUMPS) diff --git a/deal.II/cmake/configure/configure_p4est.cmake b/deal.II/cmake/configure/configure_p4est.cmake index eda005d2c5..25acd30d86 100644 --- a/deal.II/cmake/configure/configure_p4est.cmake +++ b/deal.II/cmake/configure/configure_p4est.cmake @@ -55,6 +55,8 @@ MACRO(FEATURE_P4EST_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + CHECK_MPI_INTERFACE(P4EST ${var}) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/macros/macro_check_mpi_interface.cmake b/deal.II/cmake/macros/macro_check_mpi_interface.cmake new file mode 100644 index 0000000000..e6d4295e01 --- /dev/null +++ b/deal.II/cmake/macros/macro_check_mpi_interface.cmake @@ -0,0 +1,71 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2014 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Check whether a feature is compiled against the same MPI library as the +# one deal.II picked up +# +# Usage: +# CHECK_MPI_INTERFACE(_feature _var), +# + +MACRO(CHECK_MPI_INTERFACE _feature _var) + IF(DEAL_II_WITH_MPI) + + SET(_nope FALSE) + + FOREACH(_library ${${_feature}_LIBRARIES}) + IF( _library MATCHES "/libmpi[^/]*\\.so" + AND NOT _library MATCHES "f(77|90|ort)" ) + + GET_FILENAME_COMPONENT(_file1 ${_library} REALPATH) + + SET(_not_found TRUE) + FOREACH(_mpi_library ${MPI_LIBRARIES}) + GET_FILENAME_COMPONENT(_file2 ${_mpi_library} REALPATH) + IF("${_file1}" STREQUAL "${_file2}") + SET(_not_found FALSE) + BREAK() + ENDIF() + ENDFOREACH() + + IF(_not_found) + SET(_nope TRUE) + BREAK() + ENDIF() + ENDIF() + ENDFOREACH() + + IF(_nope) + MESSAGE(STATUS "Could not find a sufficient ${_feature} installation: " + "${_feature} is compiled against a different MPI library than the one " + "deal.II picked up." + ) + TO_STRING(_str ${MPI_LIBRARIES}) + SET(PETSC_ADDITIONAL_ERROR_STRING + ${PETSC_ADDITIONAL_ERROR_STRING} + "Could not find a sufficient ${_feature} installation:\n" + "${_feature} has to be compiled against the same MPI library as deal.II " + "but the link line of ${_feature} contains:\n" + " ${_mpi_library}\n" + "which is not listed in MPI_LIBRARIES:\n" + " MPI_LIBRARIES = \"${_str}\"\n" + ) + SET(${_var} FALSE) + ENDIF() + ENDIF() +ENDMACRO() + -- 2.39.5