From 9cee0ef9bf318fdf69d2a87283c8d885c10ac240 Mon Sep 17 00:00:00 2001 From: maier Date: Sat, 9 Mar 2013 18:41:04 +0000 Subject: [PATCH] CMake: Bugfixes in configure_1_mpi.cmake - Use CMAKE_CXX_COMPILER as the sole candidate for an mpi wrapper when calling FindMPI.cmake to avoid any breakage due to mpi platform mixing. - If CMAKE_CXX_COMPILER is not an MPI wrapper, and DEAL_II_ALLOW_GENERIC_MPI is true, call FindMPI.cmake again and try to find an arbitrary MPI implementation git-svn-id: https://svn.dealii.org/trunk@28842 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/configure/configure_1_mpi.cmake | 41 +++++++++++++------ deal.II/doc/development/Config.sample | 25 +++++++---- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake index 50b55344ce..4655d82319 100644 --- a/deal.II/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/cmake/configure/configure_1_mpi.cmake @@ -16,15 +16,38 @@ # Configuration for mpi support: # +SET(DEAL_II_ALLOW_GENERIC_MPI ON CACHE BOOL + "Allow the usage of an external mpi library even if the current compiler is not an mpi wrapper" + ) + + MACRO(FEATURE_MPI_FIND_EXTERNAL var) - FIND_PACKAGE(MPI QUIET) + # + # If CMAKE_CXX_COMPILER is already an MPI wrapper, use it to determine + # the mpi implementation: + # + SET(MPI_C_COMPILER ${CMAKE_C_COMPILER}) + SET(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER}) + FIND_PACKAGE(MPI) + + IF(NOT MPI_CXX_FOUND) + # + # CMAKE_CXX_COMPILER is apparently not an mpi wrapper. + # If we're allowed to do so, search for a generic mpi implementation + # and use it. + # + IF(DEAL_II_ALLOW_GENERIC_MPI) + SET(MPI_FOUND) + UNSET(MPI_C_COMPILER CACHE) + UNSET(MPI_CXX_COMPILER CACHE) + FIND_PACKAGE(MPI) + ENDIF() + ENDIF() IF(MPI_CXX_FOUND) # Hide some variables: - MARK_AS_ADVANCED( - MPI_EXTRA_LIBRARY - MPI_LIBRARY - ) + MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY) + SET(${var} TRUE) ENDIF() ENDMACRO() @@ -39,14 +62,6 @@ MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL) # The user has to know the location of the mpi headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${MPI_CXX_INCLUDE_PATH}) - - SET(DEAL_II_USE_MPICXX OFF CACHE BOOL # Disabled by default - "Set the compiler to the detected mpi wrapper ${MPI_CXX_COMPILER}" - ) - IF(DEAL_II_USE_MPICXX) - SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) - ENDIF() - ENDMACRO() diff --git a/deal.II/doc/development/Config.sample b/deal.II/doc/development/Config.sample index 44a7c17719..be0de502ec 100644 --- a/deal.II/doc/development/Config.sample +++ b/deal.II/doc/development/Config.sample @@ -236,11 +236,22 @@ # "Build deal.II with support for mpi" # ) # -# SET(DEAL_II_USE_MPICXX ON CACHE BOOL -# "Set the compiler to the detected mpi wrapper" +# SET(DEAL_II_ALLOW_GENERIC_MPI ON CACHE BOOL +# "Allow the usage of an external mpi library even if the current compiler is not an mpi wrapper" # ) # -# TODO +# Automatic detection: +# +# Set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the appropriate MPI +# wrapper. +# +# Manual setup: +# +# SET(MPI_FOUND TRUE CACHE BOOL "") +# SET(MPI_CXX_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") +# SET(MPI_CXX_INCLUDE_PATH "include directory for mpi" CACHE STRING "") +# SET(MPI_CXX_FLAGS "..." CACHE STRING "") +# SET(MPI_CXX_LINK_FLAGS "..." CACHE STRING "") # @@ -259,10 +270,10 @@ # # Manual setup: # -# SET(METIS_FOUND TRUE CACHE BOOL "") -# SET(METIS_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") -# SET(METIS_INCLUDE_DIRS "semicolon;separated;list;of;include;dirs" CACHE STRING "") -# SET(METIS_LINKER_FLAGS "..." CACHE STRING "") +# SET(MUMPS_FOUND TRUE CACHE BOOL "") +# SET(MUMPS_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") +# SET(MUMPS_INCLUDE_DIRS "semicolon;separated;list;of;include;dirs" CACHE STRING "") +# SET(MUMPS_LINKER_FLAGS "..." CACHE STRING "") # -- 2.39.5