From: ageay Date: Tue, 9 Jul 2013 09:47:26 +0000 (+0000) Subject: Addition of METIS in MEDPartitioner. X-Git-Tag: B4KillOfAutomake~45 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=25c19348f31ce5d85aa4c5ae472603cbf87d51c2;p=modules%2Fmed.git Addition of METIS in MEDPartitioner. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 46c82bab2..115ca4285 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,7 @@ IF(NOT SALOME_MED_STANDALONE) MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR or turn option SALOME_MED_STANDALONE to ON !") ENDIF(EXISTS ${KERNEL_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") + LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files") FIND_PACKAGE(SalomeOmniORB REQUIRED) ELSE(NOT SALOME_MED_STANDALONE) LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local_without_kernel/cmake_files") @@ -87,6 +88,9 @@ IF(NOT SALOME_MED_MICROMED) FIND_PACKAGE(SalomeMEDFile REQUIRED) IF(SALOME_MED_ENABLE_PARTITIONER) FIND_PACKAGE(SalomeLibXml2 REQUIRED) + IF(SALOME_MED_PARTITIONER_METIS) + FIND_PACKAGE(SalomeMetis REQUIRED) + ENDIF(SALOME_MED_PARTITIONER_METIS) ENDIF(SALOME_MED_ENABLE_PARTITIONER) ENDIF(NOT SALOME_MED_MICROMED) diff --git a/adm_local/cmake_files/FindMETIS.cmake b/adm_local/cmake_files/FindMETIS.cmake deleted file mode 100644 index d46c79580..000000000 --- a/adm_local/cmake_files/FindMETIS.cmake +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright (C) 2007-2013 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 metis ...") - -# ------ - -IF(METIS_IS_MANDATORY STREQUAL 0) - SET(METIS_IS_MANDATORY 0) - SET(METIS_IS_OPTIONAL 1) -ENDIF(METIS_IS_MANDATORY STREQUAL 0) -IF(METIS_IS_OPTIONAL STREQUAL 0) - SET(METIS_IS_MANDATORY 1) - SET(METIS_IS_OPTIONAL 0) -ENDIF(METIS_IS_OPTIONAL STREQUAL 0) -IF(NOT METIS_IS_MANDATORY AND NOT METIS_IS_OPTIONAL) - SET(METIS_IS_MANDATORY 0) - SET(METIS_IS_OPTIONAL 1) -ENDIF(NOT METIS_IS_MANDATORY AND NOT METIS_IS_OPTIONAL) - -# ------ - -SET(MED_ENABLE_METIS 1) -IF(WITHOUT_METIS OR WITH_METIS STREQUAL 0) - SET(MED_ENABLE_METIS 0) - MESSAGE(STATUS "metis disabled from command line.") -ENDIF(WITHOUT_METIS OR WITH_METIS STREQUAL 0) - -# ------ - -IF(MED_ENABLE_METIS) - IF(WITH_METIS) - SET(METIS_ROOT_USER ${WITH_METIS}) - ENDIF(WITH_METIS) - IF(NOT METIS_ROOT_USER) - SET(METIS_ROOT_USER $ENV{METISDIR}) - ENDIF(NOT METIS_ROOT_USER) - IF(NOT METIS_ROOT_USER) - SET(METIS_ROOT_USER $ENV{METIS_ROOT}) - ENDIF(NOT METIS_ROOT_USER) - IF(NOT METIS_ROOT_USER) - SET(METIS_ROOT_USER $ENV{METISHOME}) - ENDIF(NOT METIS_ROOT_USER) -ENDIF(MED_ENABLE_METIS) - -# ------ - -IF(MED_ENABLE_METIS) - IF(NOT METIS_ROOT_USER) - FIND_PROGRAM(METIS_MAINBINARY pmetis) - IF(METIS_MAINBINARY) - MESSAGE(STATUS "metis found: ${METIS_MAINBINARY}") - IF(METIS_MAINBINARY STREQUAL /usr/bin/pmetis) - ELSE(METIS_MAINBINARY STREQUAL /usr/bin/pmetis) - SET(METIS_ROOT_USER ${METIS_MAINBINARY}) - GET_FILENAME_COMPONENT(METIS_ROOT_USER ${METIS_ROOT_USER} PATH) - ENDIF(METIS_MAINBINARY STREQUAL /usr/bin/pmetis) - ELSE(METIS_MAINBINARY) - MESSAGE(STATUS "metis not found, try to use WITH_METIS option or METIS_ROOT (or METISHOME or METISDIR) environment variable") - SET(MED_ENABLE_METIS 0) - ENDIF(METIS_MAINBINARY) - ENDIF(NOT METIS_ROOT_USER) -ENDIF(MED_ENABLE_METIS) - -# ------ - -IF(MED_ENABLE_METIS) - IF(METIS_ROOT_USER) - SET(METIS_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(METIS_ROOT_USER) - SET(METIS_FIND_PATHS_OPTION) - ENDIF(METIS_ROOT_USER) -ENDIF(MED_ENABLE_METIS) - -# ------ - -IF(MED_ENABLE_METIS) - IF(METIS_ROOT_USER) - SET(METIS_INCLUDE_PATHS ${METIS_ROOT_USER}/Lib) - ELSE(METIS_ROOT_USER) - SET(METIS_INCLUDE_PATHS) - ENDIF(METIS_ROOT_USER) - SET(METIS_INCLUDE_TO_FIND metis.h) - FIND_PATH(METIS_INCLUDE_DIR ${METIS_INCLUDE_TO_FIND} PATHS ${METIS_INCLUDE_PATHS} ${METIS_FIND_PATHS_OPTION}) - SET(METIS_DEFINITIONS) - IF(METIS_INCLUDE_DIR) - IF(METIS_ROOT_USER) - SET(METIS_INCLUDES -I${METIS_INCLUDE_DIR})#to remove - SET(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR}) - ENDIF(METIS_ROOT_USER) - SET(METIS_INCLUDES -D_METISUSEDLL_ ${METIS_INCLUDES})#to remove - SET(METIS_DEFINITIONS "${METIS_DEFINITIONS} -D_METISUSEDLL_") - MESSAGE(STATUS "${METIS_INCLUDE_TO_FIND} found in ${METIS_INCLUDE_DIR}") - ELSE(METIS_INCLUDE_DIR) - SET(MED_ENABLE_METIS 0) - IF(METIS_ROOT_USER) - MESSAGE(STATUS "${METIS_INCLUDE_TO_FIND} not found in ${METIS_INCLUDE_PATHS}, check your METIS installation.") - ELSE(METIS_ROOT_USER) - MESSAGE(STATUS "${METIS_INCLUDE_TO_FIND} not found on system, try to use WITH_METIS option or METIS_ROOT (or METISHOME or METISDIR) environment variable.") - ENDIF(METIS_ROOT_USER) - ENDIF(METIS_INCLUDE_DIR) -ENDIF(MED_ENABLE_METIS) - -# ---- - -IF(MED_ENABLE_METIS) - IF(METIS_ROOT_USER) - IF(WINDOWS) - SET(METIS_LIB_PATHS ${METIS_ROOT_USER}/dll ${METIS_ROOT_USER}/lib) - ELSE(WINDOWS) - SET(METIS_LIB_PATHS ${METIS_ROOT_USER}) - ENDIF(WINDOWS) - ELSE(METIS_ROOT_USER) - SET(METIS_LIB_PATHS) - ENDIF(METIS_ROOT_USER) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(METIS_LIB metisdll PATHS ${METIS_LIB_PATHS} ${METIS_FIND_PATHS_OPTION}) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(METIS_LIB metisddll PATHS ${METIS_LIB_PATHS} ${METIS_FIND_PATHS_OPTION}) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - FIND_LIBRARY(METIS_LIB metis PATHS ${METIS_LIB_PATHS} ${METIS_FIND_PATHS_OPTION}) - ENDIF(WINDOWS) - SET(METIS_LIBS) - IF(METIS_LIB) - SET(METIS_LIBS ${METIS_LIBS} ${METIS_LIB}) - MESSAGE(STATUS "metis lib found: ${METIS_LIB}") - ELSE(METIS_LIB) - SET(MED_ENABLE_METIS 0) - IF(METIS_ROOT_USER) - MESSAGE(STATUS "metis lib not found in ${METIS_LIB_PATHS}, check your METIS installation.") - ELSE(METIS_ROOT_USER) - MESSAGE(STATUS "metis lib not found on system, try to use WITH_METIS option or METIS_ROOT (or METISHOME or METISDIR) environment variable.") - ENDIF(METIS_ROOT_USER) - ENDIF(METIS_LIB) -ENDIF(MED_ENABLE_METIS) - -# ---- - -IF(MED_ENABLE_METIS) - SET(METIS_CPPFLAGS ${METIS_INCLUDES} -DMED_ENABLE_METIS) - SET(METIS_DEFINITIONS "${METIS_DEFINITIONS} -DMED_ENABLE_METIS") -ELSE(MED_ENABLE_METIS) - IF(METIS_IS_MANDATORY) - MESSAGE(FATAL_ERROR "metis not found ... mandatory ... abort") - ELSE(METIS_IS_MANDATORY) - MESSAGE(STATUS "metis not found ... optional ... disabled") - ENDIF(METIS_IS_MANDATORY) -ENDIF(MED_ENABLE_METIS) - -# ------ diff --git a/adm_local/cmake_files/FindMetis.cmake b/adm_local/cmake_files/FindMetis.cmake new file mode 100644 index 000000000..19d67c7b9 --- /dev/null +++ b/adm_local/cmake_files/FindMetis.cmake @@ -0,0 +1,34 @@ +# Copyright (C) 2007-2013 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 metis ...") + +SET(METIS_ROOT_DIR $ENV{METIS_ROOT_DIR} CACHE PATH "Path to the MEDFile.") +IF(METIS_ROOT_DIR) + LIST(APPEND CMAKE_LIBRARY_PATH "${METIS_ROOT_DIR}") + LIST(APPEND CMAKE_INCLUDE_PATH "${METIS_ROOT_DIR}/Lib") +ENDIF(METIS_ROOT_DIR) + +FIND_LIBRARY(METIS_LIBRARIES metis) +FIND_PATH(METIS_INCLUDE_DIRS metis.h) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Metis REQUIRED_VARS METIS_INCLUDE_DIRS METIS_LIBRARIES) diff --git a/adm_local/cmake_files/FindSalomeMetis.cmake b/adm_local/cmake_files/FindSalomeMetis.cmake new file mode 100644 index 000000000..51fd94522 --- /dev/null +++ b/adm_local/cmake_files/FindSalomeMetis.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2013 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 +# +# Author: Adrien Bruneton +# + +# Medfile detection dor Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Metis METIS_ROOT_DIR_EXP 0) +#MARK_AS_ADVANCED() diff --git a/src/MEDPartitioner/CMakeLists.txt b/src/MEDPartitioner/CMakeLists.txt index 19461e290..2cbd32485 100644 --- a/src/MEDPartitioner/CMakeLists.txt +++ b/src/MEDPartitioner/CMakeLists.txt @@ -38,13 +38,14 @@ IF(MED_ENABLE_SCOTCH) INCLUDE_DIRECTORIES(${SCOTCH_INCLUDE_DIRS}) ENDIF(MED_ENABLE_SCOTCH) -IF(MED_ENABLE_METIS) +IF(SALOME_MED_PARTITIONER_METIS) ADD_DEFINITIONS(${METIS_DEFINITIONS}) + ADD_DEFINITIONS("-DMED_ENABLE_METIS") INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIRS}) -ENDIF(MED_ENABLE_METIS) +ENDIF(SALOME_MED_PARTITIONER_METIS) IF(MED_ENABLE_PARMETIS) - ADD_DEFINITIONS(${METIS_DEFINITIONS}) + ADD_DEFINITIONS(${PARMETIS_DEFINITIONS}) INCLUDE_DIRECTORIES(${PARMETIS_INCLUDE_DIRS}) ENDIF(MED_ENABLE_PARMETIS) @@ -106,12 +107,12 @@ IF(MED_ENABLE_PARMETIS) SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${PARMETIS_DEFINITIONS}") SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBS}) ENDIF(MED_ENABLE_PARMETIS) -IF(MED_ENABLE_METIS) +IF(SALOME_MED_PARTITIONER_METIS) SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_MetisGraph.hxx) SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_MetisGraph.cxx) SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${METIS_DEFINITIONS}") - SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBS}) -ENDIF(MED_ENABLE_METIS) + SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBRARIES}) +ENDIF(SALOME_MED_PARTITIONER_METIS) IF(MED_ENABLE_SCOTCH) SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ScotchGraph.hxx) SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ScotchGraph.cxx)