From e4bb130c3481f475926ec8da821c47ec0f0aa6f5 Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 17 May 2010 12:08:31 +0000 Subject: [PATCH] *** empty log message *** --- salome_adm/cmake_files/FindMPI.cmake | 121 +++++++++++++++++++++++++++ salome_adm/cmake_files/Makefile.am | 1 + salome_adm/cmake_files/am2cmake.py | 9 +- 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 salome_adm/cmake_files/FindMPI.cmake diff --git a/salome_adm/cmake_files/FindMPI.cmake b/salome_adm/cmake_files/FindMPI.cmake new file mode 100644 index 000000000..548b01b77 --- /dev/null +++ b/salome_adm/cmake_files/FindMPI.cmake @@ -0,0 +1,121 @@ +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can 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. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ------ +# +MESSAGE(STATUS "Check for MPI ...") + +# ------ + +SET(MPI_STATUS 1) + +IF(WITH_MPI) + SET(MPI_ROOT_USER ${WITH_MPI}) +ELSE(WITH_MPI) + SET(MPI_ROOT_USER $ENV{MPI_ROOT}) +ENDIF(WITH_MPI) + +IF(NOT MPI_ROOT_USER) + FIND_PROGRAM(MPICC mpicc) + IF(MPICC) + MESSAGE(STATUS "mpicc found: ${MPICC}") + SET(MPI_ROOT ${MPICC}) + GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_ROOT} PATH) + GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_ROOT} PATH) + IF(MPICC STREQUAL /usr/bin/mpicc) + ELSE(MPICC STREQUAL /usr/bin/mpicc) + SET(MPI_ROOT_USER ${MPI_ROOT}) + ENDIF(MPICC STREQUAL /usr/bin/mpicc) + ENDIF(MPICC) +ELSE(NOT MPI_ROOT_USER) + SET(MPI_ROOT ${MPI_ROOT_USER}) +ENDIF(NOT MPI_ROOT_USER) + +# ------ + +IF(NOT MPI_ROOT) + MESSAGE(STATUS "MPI not found, try to use WITH_MPI option or MPI_ROOT environment variable.") + SET(MPI_STATUS 0) +ENDIF(NOT MPI_ROOT) + +# ------ + +IF(MPI_STATUS) + MESSAGE(STATUS "Check MPI in ${MPI_ROOT}") + + SET(MPI_INCLUDE_TO_FIND mpi.h) + + IF(MPI_ROOT_USER) + SET(MPI_ROOT ${MPI_ROOT_USER}) + SET(MPI_INCLUDE_PATHS ${MPI_ROOT} ${MPI_ROOT}/include) + FIND_PATH(MPI_INCLUDES ${MPI_INCLUDE_TO_FIND} PATHS ${MPI_INCLUDE_PATHS} NO_DEFAULT_PATH) + IF(NOT MPI_INCLUDES) + MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} not found in ${MPI_INCLUDE_PATHS}, check your MPI installation.") + SET(MPI_STATUS 0) + ENDIF(NOT MPI_INCLUDES) + ELSE(MPI_ROOT_USER) + FIND_PATH(MPI_INCLUDES ${MPI_INCLUDE_TO_FIND}) + IF(NOT MPI_INCLUDES) + MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} not found on system, try to use WITH_MPI option or MPI_ROOT environment variable.") + SET(MPI_STATUS 0) + ENDIF(NOT MPI_INCLUDES) + GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_INCLUDES} PATH) + ENDIF(MPI_ROOT_USER) + + MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} found in ${MPI_INCLUDES}") + + SET(MPI_INCLUDES -I${MPI_INCLUDES}) + + # ------ + + IF(WINDOWS) + FIND_LIBRARY(MPI_LIB_THREAD libboost_thread-vc90-mt-gd-1_35 ${MPI_ROOT}/lib) + FIND_LIBRARY(MPI_LIB_DATE_TIME libboost_date_time-vc90-mt-gd-1_35 ${MPI_ROOT}/lib) + ELSE(WINDOWS) + FOREACH(lib mpi_cxx mpi mpich) + FIND_LIBRARY(MPI_LIB ${lib} ${MPI_ROOT}/lib) + IF(MPI_LIB) + IF(lib STREQUAL mpich) + SET(MPI_INCLUDES ${MPI_INCLUDES} -DMPICH_IGNORE_CXX_SEEK) + ENDIF(lib STREQUAL mpich) + ENDIF(MPI_LIB) + ENDFOREACH(lib mpi_cxx mpi mpich) + IF(NOT MPI_LIB) + MESSAGE(STATUS "MPI lib not found, check your MPI installation.") + SET(MPI_STATUS 0) + ENDIF(NOT MPI_LIB) + MESSAGE(STATUS "MPI lib : ${MPI_LIB}") + ENDIF(WINDOWS) + + SET(MPI_LIBS ${MPI_LIB}) + + MESSAGE(STATUS "MPI libs: ${MPI_LIBS}") +ENDIF(MPI_STATUS) + +# ------ + +IF(MPI_STATUS) + SET(MPI_IS_OK ON) +ELSE(MPI_STATUS) + IF(MPI_IS_MANDATORY) + MESSAGE(FATAL_ERROR "MPI not found but mandatory") + ELSE(MPI_IS_MANDATORY) + MESSAGE(STATUS "MPI not found. Build procedure depending of mpi will be disable") + ENDIF(MPI_IS_MANDATORY) +ENDIF(MPI_STATUS) diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index e7852c175..2c2772d47 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -30,6 +30,7 @@ FindDOXYGEN.cmake \ FindHDF5.cmake \ FindKERNEL.cmake \ FindLIBXML2.cmake \ +FindMPI.cmake \ FindOMNIORB.cmake \ FindPLATFORM.cmake \ FindPTHREADS.cmake \ diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index c069e76b8..8e0774b15 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -439,6 +439,7 @@ class CMakeFile(object): INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake) """) pass else: @@ -456,9 +457,11 @@ class CMakeFile(object): INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake) ELSE(KERNEL_ROOT_DIR) INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake) ENDIF(KERNEL_ROOT_DIR) """) else: @@ -474,6 +477,7 @@ class CMakeFile(object): INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake) """) pass @@ -505,7 +509,6 @@ class CMakeFile(object): IF(WINDOWS) INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake) ENDIF(WINDOWS) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake) """) pass if self.module == "smesh": @@ -1872,9 +1875,13 @@ if __name__ == "__main__": pass pass # -- + from sys import stdout for f in files: if f in ["Makefile.am", "Makefile.am.cmake"]: + stdout.write("Scanning %s %s ..."%(root, f)) + stdout.flush() convertAmFile(the_root, root, dirs, files, f, module) + stdout.write(" done.\n") pass pass pass -- 2.39.2