Skip to content

Commit

Permalink
METIS/ParMETIS build updated. Ticket NOAA-EMC#1309
Browse files Browse the repository at this point in the history
Older versions of ParMETIS have METIS and GKLIB included
with the source code. Static link libraries libmetis.a
contains GKLib object files. CMake configuration was
updated to only link against GKLIB is the library is
found in METIS_PATH.

Changes
-------
 [x] FindGKLIB.cmake is optional with METIS depentencies for
     target linker library being added when found.
  • Loading branch information
stefanzieger committed Oct 28, 2024
1 parent 9a91e73 commit 53699de
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions cmake/FindGKLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ set_target_properties(GKLIB::GKLIB PROPERTIES
IMPORTED_LOCATION "${gklib_lib}"
INTERFACE_INCLUDE_DIRECTORIES "${gklib_inc}")

## Finalize find_package
include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
REQUIRED_VARS gklib_lib
gklib_inc)

message(STATUS "Found GKLIB: ${gklib_lib}")
if(gklib_inc MATCHES "NOTFOUND" OR gklib_lib MATCHES "NOTFOUND")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
else()
find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
REQUIRED_VARS gklib_lib
gklib_inc)
endif()
12 changes: 7 additions & 5 deletions cmake/FindMETIS.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
find_library(metis_lib NAMES libmetis.a libmetis.so libmetis.dylib HINTS ENV METIS_PATH PATH_SUFFIXES lib)
find_path(metis_inc metis.h HINTS ENV METIS_PATH PATH_SUFFIXES include)

find_package(GKLIB REQUIRED)

add_library(METIS::METIS STATIC IMPORTED)

set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LOCATION "${metis_lib}"
INTERFACE_INCLUDE_DIRECTORIES "${metis_inc}")

target_link_libraries(METIS::METIS INTERFACE GKLIB::GKLIB)
find_package(GKLIB)
if(NOT GKLIB_FOUND)
message(STATUS "GKLIB not found")
target_link_libraries(METIS::METIS)
else()
target_link_libraries(METIS::METIS INTERFACE GKLIB::GKLIB)
endif()

## Finalize find_package
include(FindPackageHandleStandardArgs)
Expand All @@ -18,5 +22,3 @@ find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
REQUIRED_VARS metis_lib
metis_inc)

message(STATUS "Found METIS: ${metis_lib}")
2 changes: 0 additions & 2 deletions cmake/FindParMETIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
REQUIRED_VARS parmetis_lib
parmetis_inc)

message(STATUS "Found ParMETIS: ${parmetis_lib}")

0 comments on commit 53699de

Please sign in to comment.