]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Bugfixes in configure_1_mpi.cmake
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 9 Mar 2013 18:41:04 +0000 (18:41 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 9 Mar 2013 18:41:04 +0000 (18:41 +0000)
- 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
deal.II/doc/development/Config.sample

index 50b55344ce2d6a001a25b7e1adfa369033ab060e..4655d82319314ab62d7d41d9c61fce46f171a2e6 100644 (file)
 # 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()
 
 
index 44a7c17719983aae4e0327304d7fb79d8fa20038..be0de502ece37417a8c80468b8c5e818c20d1efc 100644 (file)
 #   "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 "")
 #
 
 
 #
 # 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 "")
 #
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.