Skip to content

Commit

Permalink
add FindMETIS.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Dec 21, 2023
1 parent 403dae5 commit 39a601b
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DS_Store
build
playground
dependencies
.vscode
dump
*.msh
Expand Down
79 changes: 79 additions & 0 deletions dependencies/FindMETIS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindMETIS
-------
Michael Hirsch, Ph.D.

Finds the METIS library.
NOTE: If libparmetis used, libmetis must also be linked.

Imported Targets
^^^^^^^^^^^^^^^^

METIS::METIS

Result Variables
^^^^^^^^^^^^^^^^

METIS_LIBRARIES
libraries to be linked

METIS_INCLUDE_DIRS
dirs to be included

#]=======================================================================]


if("parallel" IN_LIST METIS_FIND_COMPONENTS)
find_library(PARMETIS_LIBRARY
NAMES parmetis
PATH_SUFFIXES METIS libmetis
DOC "ParMETIS library"
)
if(PARMETIS_LIBRARY)
set(METIS_parallel_FOUND true)
endif()
endif()

find_library(METIS_LIBRARY
NAMES metis
PATH_SUFFIXES METIS libmetis
DOC "METIS library"
)

if(parallel IN_LIST METIS_FIND_COMPONENTS)
set(metis_inc parmetis.h)
else()
set(metis_inc metis.h)
endif()

find_path(METIS_INCLUDE_DIR
NAMES ${metis_inc}
PATH_SUFFIXES METIS openmpi-x86_64 mpich-x86_64
DOC "METIS include directory"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(METIS
REQUIRED_VARS METIS_LIBRARY METIS_INCLUDE_DIR
HANDLE_COMPONENTS
)

if(METIS_FOUND)

set(METIS_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARY})
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})

message(VERBOSE "METIS libraries: ${METIS_LIBRARIES}
METIS include directories: ${METIS_INCLUDE_DIRS}")

if(NOT TARGET METIS::METIS)
add_library(METIS::METIS INTERFACE IMPORTED)
set_property(TARGET METIS::METIS PROPERTY INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}")
set_property(TARGET METIS::METIS PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIR}")
endif()
endif(METIS_FOUND)

mark_as_advanced(METIS_INCLUDE_DIR METIS_LIBRARY PARMETIS_LIBRARY)
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ WORKDIR $LIB_DIR
RUN sudo git clone https://github.com/scivision/mumps.git
WORKDIR ./mumps
RUN sudo git checkout v5.6.2.1
RUN sudo wget -O cmake/FindMETIS.cmake https://github.com/LLNL/scaleupROM/raw/install/dependencies/FindMETIS.cmake
# RUN sudo sed -i 's/if(parallel IN_LIST METIS_FIND_COMPONENTS)/if("parallel" IN_LIST METIS_FIND_COMPONENTS)/g' cmake/FindMETIS.cmake

# RUN sudo sed -i 's/option(CMAKE_TLS_VERIFY "Verify TLS certificates" ON)/option(CMAKE_TLS_VERIFY "Verify TLS certificates" OFF)/g' options.cmake
RUN sudo sed -i 's/if(parallel IN_LIST METIS_FIND_COMPONENTS)/if("parallel" IN_LIST METIS_FIND_COMPONENTS)/g' cmake/FindMETIS.cmake
# # RUN sudo sed -i 's/TLS_VERIFY true/TLS_VERIFY false/g' cmake/mumps_src.cmake
# RUN sudo sed -i '/NAMES parmetis/a PATHS "$ENV{PARMETIS_DIR}/lib"' cmake/FindMETIS.cmake
# RUN sudo sed -i '/NAMES metis/a PATHS "$ENV{METIS_DIR}/lib"' cmake/FindMETIS.cmake
Expand Down

0 comments on commit 39a601b

Please sign in to comment.