Skip to content

Commit 66137f3

Browse files
committed
latest metis working locally on macos
1 parent 7fb5045 commit 66137f3

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

cmake/FindHipoDeps.cmake

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# BLAS
2-
option(BLAS_ROOT "Root directory of BLAS or OpenBLAS" "")
2+
set(BLAS_ROOT "" CACHE STRING "Root directory of BLAS or OpenBLAS")
33
message(STATUS "BLAS_ROOT is " ${BLAS_ROOT})
44

55
if (WIN32)
6-
76
find_package(OpenBLAS CONFIG REQUIRED)
87
message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}")
9-
108
elseif(NOT APPLE)
119
# LINUX
1210
find_library(OPENBLAS_LIB
@@ -26,11 +24,10 @@ elseif(NOT APPLE)
2624
endif(NOT BLAS_LIB)
2725
message("Found BLAS library at ${BLAS_LIB}")
2826
endif(OPENBLAS_LIB)
29-
3027
endif()
3128

3229
# METIS
33-
option(METIS_ROOT "Root directory of METIS" "")
30+
set(METIS_ROOT "" CACHE STRING "Root directory of METIS")
3431
message(STATUS "METIS_ROOT is " ${METIS_ROOT})
3532

3633
find_package(metis CONFIG)
@@ -53,4 +50,47 @@ else()
5350
NO_DEFAULT_PATH)
5451

5552
message("Found Metis library at ${METIS_LIB}")
53+
endif()
54+
55+
# GKlib optional for newer versions on ubuntu and macos
56+
set(GKLIB_ROOT "" CACHE STRING "Root directory of GKlib")
57+
if (NOT (GKLIB_ROOT STREQUAL ""))
58+
message(STATUS "GKLIB_ROOT is " ${GKLIB_ROOT})
59+
60+
find_package(GKlib CONFIG)
61+
62+
if(GKlib_FOUND)
63+
message(STATUS "gklib CMake config path: ${GKlib_DIR}")
64+
65+
# get_cmake_property(_vars VARIABLES)
66+
# foreach(_v IN LISTS _vars)
67+
# if(_v MATCHES "GKlib")
68+
# message(STATUS "${_v} = ${${_v}}")
69+
# endif()
70+
# endforeach()
71+
72+
# get_property(_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY IMPORTED_TARGETS)
73+
# foreach(_t IN LISTS _targets)
74+
# if(_t MATCHES "GKlib")
75+
# message(STATUS "GKlib exported target: ${_t}")
76+
# endif()
77+
# endforeach()
78+
79+
else()
80+
find_path(GKLIB_PATH
81+
NAMES "gklib.h"
82+
REQUIRED
83+
PATHS "${GKLIB_ROOT}/include"
84+
NO_DEFAULT_PATH)
85+
86+
message("Found GKlib header at ${GKLIB_PATH}")
87+
88+
find_library(GKLIB_LIB
89+
NAMES GKlib libGKlib
90+
REQUIRED
91+
PATHS "${GKLIB_ROOT}/lib"
92+
NO_DEFAULT_PATH)
93+
94+
message("Found GKlib library at ${GKLIB_LIB}")
95+
endif()
5696
endif()

highs/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ else()
210210
target_include_directories(highs PRIVATE "${METIS_PATH}")
211211
target_link_libraries(highs "${METIS_LIB}")
212212
endif()
213+
214+
if (NOT (GKLIB_ROOT STREQUAL ""))
215+
if(GKlib_FOUND)
216+
target_link_libraries(highs GKlib::GKlib)
217+
else()
218+
target_include_directories(highs PRIVATE "${GKLIB_PATH}")
219+
target_link_libraries(highs "${GKLIB_LIB}")
220+
endif()
221+
endif()
213222
endif()
214223

215224
if(MSVC)

0 commit comments

Comments
 (0)