| 1 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 |
index a15d19a..7210a61 100644 |
| 3 |
--- a/CMakeLists.txt |
| 4 |
+++ b/CMakeLists.txt |
| 5 |
@@ -1,9 +1,9 @@ |
| 6 |
-cmake_minimum_required(VERSION 2.8) |
| 7 |
+cmake_minimum_required(VERSION 3.22) |
| 8 |
project(METIS C) |
| 9 |
|
| 10 |
set(SHARED FALSE CACHE BOOL "build a shared library") |
| 11 |
|
| 12 |
-if(MSVC) |
| 13 |
+if(0) |
| 14 |
set(METIS_INSTALL FALSE) |
| 15 |
else() |
| 16 |
set(METIS_INSTALL TRUE) |
| 17 |
@@ -34,19 +34,8 @@ include(./conf/gkbuild.cmake) |
| 18 |
# |
| 19 |
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${METIS_COPTIONS}") |
| 20 |
|
| 21 |
- |
| 22 |
-# Add include directories. |
| 23 |
-# i.e., the -I equivalent |
| 24 |
-include_directories(build/xinclude) |
| 25 |
-include_directories(${GKLIB_PATH}/include) |
| 26 |
-include_directories(${CMAKE_INSTALL_PREFIX}/include) |
| 27 |
- |
| 28 |
-# List of paths that the compiler will search for library files. |
| 29 |
-# i.e., the -L equivalent |
| 30 |
-link_directories(${GKLIB_PATH}/lib) |
| 31 |
-link_directories(${CMAKE_INSTALL_PREFIX}/lib) |
| 32 |
- |
| 33 |
# Recursively look for CMakeLists.txt in subdirs. |
| 34 |
-add_subdirectory("build/xinclude") |
| 35 |
+add_subdirectory("include") |
| 36 |
add_subdirectory("libmetis") |
| 37 |
-add_subdirectory("programs") |
| 38 |
+ |
| 39 |
+include(install_config.cmake) |
| 40 |
diff --git a/conf/gkbuild.cmake b/conf/gkbuild.cmake |
| 41 |
index 96435e5..772cd12 100644 |
| 42 |
--- a/conf/gkbuild.cmake |
| 43 |
+++ b/conf/gkbuild.cmake |
| 44 |
@@ -16,7 +16,6 @@ option(GKRAND "enable GKRAND support" OFF) |
| 45 |
|
| 46 |
# Add compiler flags. |
| 47 |
if(MSVC) |
| 48 |
- set(GK_COPTS "/Ox") |
| 49 |
set(GK_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX") |
| 50 |
elseif(MINGW) |
| 51 |
set(GK_COPTS "-DUSE_GKREGEX") |
| 52 |
@@ -31,14 +30,16 @@ if(CMAKE_COMPILER_IS_GNUCC) |
| 53 |
set(GK_COPTIONS "${GK_COPTIONS} -std=c99 -fno-strict-aliasing") |
| 54 |
if(VALGRIND) |
| 55 |
set(GK_COPTIONS "${GK_COPTIONS} -march=x86-64 -mtune=generic") |
| 56 |
+elseif(1) |
| 57 |
+ # Use flags from toolchain and triplet |
| 58 |
else() |
| 59 |
set(GK_COPTIONS "${GK_COPTIONS} -march=native") |
| 60 |
endif(VALGRIND) |
| 61 |
if(NOT MINGW) |
| 62 |
set(GK_COPTIONS "${GK_COPTIONS} -fPIC") |
| 63 |
endif(NOT MINGW) |
| 64 |
# GCC warnings. |
| 65 |
- 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") |
| 66 |
+ set(GK_COPTIONS "${GK_COPTIONS} -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label") |
| 67 |
elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun") |
| 68 |
# Sun insists on -xc99. |
| 69 |
set(GK_COPTIONS "${GK_COPTIONS} -xc99") |
| 70 |
@@ -69,7 +70,7 @@ endif(OPENMP) |
| 71 |
if(GDB) |
| 72 |
set(GK_COPTS "${GK_COPTS} -g") |
| 73 |
set(GK_COPTIONS "${GK_COPTIONS} -Werror") |
| 74 |
-else() |
| 75 |
+elseif(0) |
| 76 |
set(GK_COPTS "-O3") |
| 77 |
endif(GDB) |
| 78 |
|
| 79 |
diff --git a/include/metis.h b/include/metis.h |
| 80 |
index 7fef0e7..f8e5dcf 100644 |
| 81 |
--- a/include/metis.h |
| 82 |
+++ b/include/metis.h |
| 83 |
@@ -30,7 +30,7 @@ |
| 84 |
GCC does provides these definitions in stdint.h, but it may require some |
| 85 |
modifications on other architectures. |
| 86 |
--------------------------------------------------------------------------*/ |
| 87 |
-//#define IDXTYPEWIDTH 32 |
| 88 |
+#define IDXTYPEWIDTH 32 |
| 89 |
|
| 90 |
|
| 91 |
/*-------------------------------------------------------------------------- |
| 92 |
@@ -40,7 +40,7 @@ |
| 93 |
32 : single precission floating point (float) |
| 94 |
64 : double precission floating point (double) |
| 95 |
--------------------------------------------------------------------------*/ |
| 96 |
-//#define REALTYPEWIDTH 32 |
| 97 |
+#define REALTYPEWIDTH 32 |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
@@ -72,10 +72,14 @@ typedef __int64 int64_t; |
| 102 |
#define PRId64 "I64d" |
| 103 |
#define SCNd32 "ld" |
| 104 |
#define SCNd64 "I64d" |
| 105 |
+#ifdef _WIN32 |
| 106 |
+#include <stdint.h> |
| 107 |
+#else |
| 108 |
#define INT32_MIN ((int32_t)_I32_MIN) |
| 109 |
#define INT32_MAX _I32_MAX |
| 110 |
#define INT64_MIN ((int64_t)_I64_MIN) |
| 111 |
#define INT64_MAX _I64_MAX |
| 112 |
+#endif // ^^^ !_WIN32 |
| 113 |
#else |
| 114 |
#include <inttypes.h> |
| 115 |
#endif |
| 116 |
diff --git a/libmetis/CMakeLists.txt b/libmetis/CMakeLists.txt |
| 117 |
index fc6cec6..8aeb89a 100644 |
| 118 |
--- a/libmetis/CMakeLists.txt |
| 119 |
+++ b/libmetis/CMakeLists.txt |
| 120 |
@@ -6,10 +6,9 @@ file(GLOB metis_sources *.c) |
| 121 |
|
| 122 |
# Build libmetis. |
| 123 |
add_library(metis ${METIS_LIBRARY_TYPE} ${metis_sources}) |
| 124 |
+find_package(GKlib CONFIG REQUIRED) |
| 125 |
+target_link_libraries(metis PUBLIC GKlib) |
| 126 |
+target_include_directories(metis PRIVATE "../include") |
| 127 |
|
| 128 |
-if(METIS_INSTALL) |
| 129 |
- install(TARGETS metis |
| 130 |
- LIBRARY DESTINATION lib |
| 131 |
- RUNTIME DESTINATION lib |
| 132 |
- ARCHIVE DESTINATION lib) |
| 133 |
-endif() |
| 134 |
+install(TARGETS metis EXPORT metisTargets |
| 135 |
+ INCLUDES DESTINATION include) |
| 136 |
diff --git a/libmetis/metislib.h b/libmetis/metislib.h |
| 137 |
index dc224f4..1efccda 100644 |
| 138 |
--- a/libmetis/metislib.h |
| 139 |
+++ b/libmetis/metislib.h |
| 140 |
@@ -31,7 +31,7 @@ |
| 141 |
#include "proto.h" |
| 142 |
|
| 143 |
|
| 144 |
-#if defined(COMPILER_MSC) |
| 145 |
+#if defined(COMPILER_MSC) && (_MSC_VER < 1900) |
| 146 |
#if defined(rint) |
| 147 |
#undef rint |
| 148 |
#endif |