diff --git a/ports/metis/CONTROL b/ports/metis/CONTROL new file mode 100644 index 000000000..cc604ce8f --- /dev/null +++ b/ports/metis/CONTROL @@ -0,0 +1,3 @@ +Source: metis +Version: 5.1.0 +Description: Serial Graph Partitioning and Fill-reducing Matrix Ordering diff --git a/ports/metis/disable-programs.patch b/ports/metis/disable-programs.patch new file mode 100644 index 000000000..0c23be553 --- /dev/null +++ b/ports/metis/disable-programs.patch @@ -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") diff --git a/ports/metis/enable-install.patch b/ports/metis/enable-install.patch new file mode 100644 index 000000000..9f36623ad --- /dev/null +++ b/ports/metis/enable-install.patch @@ -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) diff --git a/ports/metis/fix-gklib-vs14-math.patch b/ports/metis/fix-gklib-vs14-math.patch new file mode 100644 index 000000000..e83a68230 --- /dev/null +++ b/ports/metis/fix-gklib-vs14-math.patch @@ -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)) + diff --git a/ports/metis/fix-metis-vs14-math.patch b/ports/metis/fix-metis-vs14-math.patch new file mode 100644 index 000000000..a296213e8 --- /dev/null +++ b/ports/metis/fix-metis-vs14-math.patch @@ -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 + + +-#if defined(COMPILER_MSC) ++#if defined(COMPILER_MSC) && (_MSC_VER < 1900) + #if defined(rint) + #undef rint + #endif diff --git a/ports/metis/fix-runtime-install-destination.patch b/ports/metis/fix-runtime-install-destination.patch new file mode 100644 index 000000000..8d9147e5f --- /dev/null +++ b/ports/metis/fix-runtime-install-destination.patch @@ -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() diff --git a/ports/metis/portfile.cmake b/ports/metis/portfile.cmake new file mode 100644 index 000000000..c53adde4e --- /dev/null +++ b/ports/metis/portfile.cmake @@ -0,0 +1,47 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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)