aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/metis/build-fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/metis/build-fixes.patch')
-rw-r--r--vcpkg/ports/metis/build-fixes.patch146
1 files changed, 146 insertions, 0 deletions
diff --git a/vcpkg/ports/metis/build-fixes.patch b/vcpkg/ports/metis/build-fixes.patch
new file mode 100644
index 0000000..0328e25
--- /dev/null
+++ b/vcpkg/ports/metis/build-fixes.patch
@@ -0,0 +1,146 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ef34603..0168a4b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,9 +1,12 @@
+ cmake_minimum_required(VERSION 3.10)
+ project(METIS C)
+
+-set(SHARED FALSE CACHE BOOL "build a shared library")
++set(SHARED "${BUILD_SHARED_LIBS}" CACHE BOOL "build a shared library")
++if(WIN32 AND SHARED)
++ add_compile_definitions(-D_WINDLL)
++endif()
+
+-if(MSVC)
++if(0)
+ set(METIS_INSTALL FALSE)
+ else()
+ set(METIS_INSTALL TRUE)
+@@ -38,15 +41,12 @@ include(./conf/gkbuild.cmake)
+ # Add include directories.
+ # i.e., the -I equivalent
+ include_directories(build/xinclude)
+-include_directories(${GKLIB_PATH}/include)
+-include_directories(${CMAKE_INSTALL_PREFIX}/include)
+
+ # List of paths that the compiler will search for library files.
+ # i.e., the -L equivalent
+-link_directories(${GKLIB_PATH}/lib)
+-link_directories(${CMAKE_INSTALL_PREFIX}/lib)
+
+ # Recursively look for CMakeLists.txt in subdirs.
+ add_subdirectory("build/xinclude")
+ add_subdirectory("libmetis")
+-add_subdirectory("programs")
++
++include(install_config.cmake)
+diff --git a/conf/gkbuild.cmake b/conf/gkbuild.cmake
+index 591ece4..3719093 100644
+--- a/conf/gkbuild.cmake
++++ b/conf/gkbuild.cmake
+@@ -16,7 +16,6 @@ option(GKRAND "enable GKRAND support" OFF)
+
+ # Add compiler flags.
+ if(MSVC)
+- set(GK_COPTS "/Ox")
+ set(GK_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX")
+ elseif(MINGW)
+ set(GK_COPTS "-DUSE_GKREGEX")
+@@ -31,6 +30,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
+ set(GK_COPTIONS "${GK_COPTIONS} -std=c99 -fno-strict-aliasing")
+ if(VALGRIND)
+ set(GK_COPTIONS "${GK_COPTIONS} -march=x86-64 -mtune=generic")
++elseif(1)
++ # Use flags from toolchain and triplet
+ else()
+ # -march=native is not a valid flag on PPC:
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "power|ppc|powerpc|ppc64|powerpc64" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc|ppc64"))
+@@ -44,6 +45,7 @@ endif(VALGRIND)
+ endif(NOT MINGW)
+ # GCC warnings.
+ set(GK_COPTIONS "${GK_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label")
++ string(REPLACE " -Werror " " " GK_COPTIONS "${GK_COPTIONS}")
+ elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun")
+ # Sun insists on -xc99.
+ set(GK_COPTIONS "${GK_COPTIONS} -xc99")
+@@ -74,6 +76,8 @@ endif(OPENMP)
+ if(GDB)
+ set(GK_COPTS "${GK_COPTS} -g")
+ set(GK_COPTIONS "${GK_COPTIONS} -Werror")
++elseif(1)
++ # Use flags from toolchain and triplet
+ else()
+ set(GK_COPTS "-O3")
+ endif(GDB)
+diff --git a/include/metis.h b/include/metis.h
+index ab475fe..8033858 100644
+--- a/include/metis.h
++++ b/include/metis.h
+@@ -30,7 +30,7 @@
+ GCC does provides these definitions in stdint.h, but it may require some
+ modifications on other architectures.
+ --------------------------------------------------------------------------*/
+-//#define IDXTYPEWIDTH 32
++#define IDXTYPEWIDTH 32
+
+
+ /*--------------------------------------------------------------------------
+@@ -40,7 +40,7 @@
+ 32 : single precision floating point (float)
+ 64 : double precision floating point (double)
+ --------------------------------------------------------------------------*/
+-//#define REALTYPEWIDTH 32
++#define REALTYPEWIDTH 32
+
+
+
+@@ -72,10 +72,14 @@ typedef __int64 int64_t;
+ #define PRId64 "I64d"
+ #define SCNd32 "ld"
+ #define SCNd64 "I64d"
++#ifdef _WIN32
++#include <stdint.h>
++#else
+ #define INT32_MIN ((int32_t)_I32_MIN)
+ #define INT32_MAX _I32_MAX
+ #define INT64_MIN ((int64_t)_I64_MIN)
+ #define INT64_MAX _I64_MAX
++#endif // ^^^ !_WIN32
+ #else
+ #include <inttypes.h>
+ #endif
+diff --git a/libmetis/CMakeLists.txt b/libmetis/CMakeLists.txt
+index fc6cec6..a56f6ca 100644
+--- a/libmetis/CMakeLists.txt
++++ b/libmetis/CMakeLists.txt
+@@ -6,10 +6,15 @@ file(GLOB metis_sources *.c)
+
+ # Build libmetis.
+ add_library(metis ${METIS_LIBRARY_TYPE} ${metis_sources})
++target_include_directories(metis INTERFACE $<INSTALL_INTERFACE:include>)
++
++find_package(GKlib CONFIG REQUIRED)
++target_link_libraries(metis PRIVATE GKlib::GKlib)
+
+ if(METIS_INSTALL)
+ install(TARGETS metis
++ EXPORT metisTargets
+ LIBRARY DESTINATION lib
+- RUNTIME DESTINATION lib
++ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib)
+ endif()
+diff --git a/libmetis/metislib.h b/libmetis/metislib.h
+index dc224f4..1efccda 100644
+--- a/libmetis/metislib.h
++++ b/libmetis/metislib.h
+@@ -31,7 +31,7 @@
+ #include "proto.h"
+
+
+-#if defined(COMPILER_MSC)
++#if defined(COMPILER_MSC) && (_MSC_VER < 1900)
+ #if defined(rint)
+ #undef rint
+ #endif