Skip to content

Commit

Permalink
Add port for metis
Browse files Browse the repository at this point in the history
  • Loading branch information
albertziegenhagel committed Jan 11, 2017
1 parent b966acc commit 4bf2b19
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ports/metis/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Source: metis
Version: 5.1.0
Description: Serial Graph Partitioning and Fill-reducing Matrix Ordering
8 changes: 8 additions & 0 deletions ports/metis/disable-programs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--- a/CMakeLists.txt Wed Dec 21 18:24:22 2016
+++ b/CMakeLists.txt Wed Dec 21 18:24:26 2016
@@ -20,4 +20,4 @@
# Recursively look for CMakeLists.txt in subdirs.
add_subdirectory("include")
add_subdirectory("libmetis")
-add_subdirectory("programs")
+# add_subdirectory("programs")
15 changes: 15 additions & 0 deletions ports/metis/enable-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- a/CMakeLists.txt Sat Mar 30 17:24:45 2013
+++ b/CMakeLists.txt Wed Dec 21 18:23:43 2016
@@ -4,11 +4,7 @@
set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib")
set(SHARED FALSE CACHE BOOL "build a shared library")

-if(MSVC)
- set(METIS_INSTALL FALSE)
-else()
- set(METIS_INSTALL TRUE)
-endif()
+set(METIS_INSTALL TRUE)

# Configure libmetis library.
if(SHARED)
11 changes: 11 additions & 0 deletions ports/metis/fix-gklib-vs14-math.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/GKlib/gk_arch.h Wed Dec 21 18:34:18 2016
+++ b/GKlib/gk_arch.h Wed Dec 21 18:30:49 2016
@@ -58,7 +58,7 @@
#define PTRDIFF_MAX INT64_MAX
#endif

-#ifdef __MSC__
+#if defined(__MSC__) && (_MSC_VER < 1900)
/* MSC does not have rint() function */
#define rint(x) ((int)((x)+0.5))

11 changes: 11 additions & 0 deletions ports/metis/fix-metis-vs14-math.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/libmetis/metislib.h Sat Mar 30 17:24:45 2013
+++ b/libmetis/metislib.h Wed Dec 21 18:30:59 2016
@@ -31,7 +31,7 @@
#include <proto.h>


-#if defined(COMPILER_MSC)
+#if defined(COMPILER_MSC) && (_MSC_VER < 1900)
#if defined(rint)
#undef rint
#endif
10 changes: 10 additions & 0 deletions ports/metis/fix-runtime-install-destination.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/libmetis/CMakeLists.txt Sat Mar 30 17:24:45 2013
+++ b/libmetis/CMakeLists.txt Wed Dec 21 17:41:37 2016
@@ -11,6 +11,6 @@
if(METIS_INSTALL)
install(TARGETS metis
LIBRARY DESTINATION lib
- RUNTIME DESTINATION lib
+ RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib)
endif()
47 changes: 47 additions & 0 deletions ports/metis/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#

include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/metis-5.1.0)
vcpkg_download_distfile(ARCHIVE
URLS "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz"
FILENAME "metis-5.1.0.tar.gz"
SHA512 deea47749d13bd06fbeaf98a53c6c0b61603ddc17a43dae81d72c8015576f6495fd83c11b0ef68d024879ed5415c14ebdbd87ce49c181bdac680573bea8bdb25
)
vcpkg_extract_source_archive(${ARCHIVE})

vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/enable-install.patch
${CMAKE_CURRENT_LIST_DIR}/disable-programs.patch
${CMAKE_CURRENT_LIST_DIR}/fix-runtime-install-destination.patch
${CMAKE_CURRENT_LIST_DIR}/fix-metis-vs14-math.patch
${CMAKE_CURRENT_LIST_DIR}/fix-gklib-vs14-math.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(OPTIONS -DSHARED=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON)
else()
set(OPTIONS -DSHARED=OFF)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
${OPTIONS}
)

vcpkg_install_cmake()
vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/metis)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/metis/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/metis/copyright)

0 comments on commit 4bf2b19

Please sign in to comment.