Skip to content

Commit 446f0de

Browse files
committed
respect _ROOT in search order
1 parent 8095977 commit 446f0de

File tree

4 files changed

+77
-28
lines changed

4 files changed

+77
-28
lines changed

.github/workflows/hipo-win.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
shell: pwsh
5757
working-directory: ${{runner.workspace}}/build
5858
run: |
59-
& ".\Release\bin\highs.exe" --solver=hipo `
59+
& ".\${{ matrix.config }}\bin\highs.exe" --solver=hipo `
6060
"$env:GITHUB_WORKSPACE/check/instances/afiro.mps"
6161
6262
- name: Ctest

check/TestLpSolvers.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ TEST_CASE("choose-lp-solver", "[highs_lp_solver]") {
531531
REQUIRE(h.getInfo().pdlp_iteration_count > 0);
532532

533533
REQUIRE(h.setOptionValue(kSolverString, kIpmString) == HighsStatus::kOk);
534+
h.setOptionValue("output_flag", true);
534535
h.run();
535536
REQUIRE(h.getInfo().ipm_iteration_count > 0);
536537

cmake/FindHipoDeps.cmake

Lines changed: 67 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,53 @@ set(BLAS_ROOT "" CACHE STRING "Root directory of BLAS or OpenBLAS")
33
message(STATUS "BLAS_ROOT is " ${BLAS_ROOT})
44

55
if (WIN32)
6-
find_package(OpenBLAS CONFIG REQUIRED)
6+
find_package(OpenBLAS CONFIG REQUIRED)
77
message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}")
88
elseif(NOT APPLE)
99
# LINUX
10-
find_library(OPENBLAS_LIB
11-
NAMES openblas
12-
HINTS "${BLAS_ROOT}/lib")
13-
14-
if(OPENBLAS_LIB)
15-
message("Found OpenBLAS library at ${OPENBLAS_LIB}")
16-
17-
else(OPENBLAS_LIB)
18-
find_library(BLAS_LIB
19-
NAMES blas HINTS
20-
"${BLAS_ROOT}/lib")
21-
22-
if(NOT BLAS_LIB)
23-
message(FATAL_ERROR "No BLAS library found")
24-
endif(NOT BLAS_LIB)
25-
message("Found BLAS library at ${BLAS_LIB}")
26-
endif(OPENBLAS_LIB)
10+
11+
# If a BLAS install was specified try to use it first.
12+
if (NOT (BLAS_ROOT STREQUAL ""))
13+
message(STATUS "Looking for blas CMake targets file in " ${BLAS_ROOT})
14+
find_package(OpenBLAS CONFIG NO_DEFAULT_PATH)
15+
else()
16+
find_package(OpenBLAS CONFIG)
17+
endif()
18+
19+
if(OpenBLAS_FOUND)
20+
message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}")
21+
else()
22+
find_library(OPENBLAS_LIB
23+
NAMES openblas
24+
HINTS "${BLAS_ROOT}/lib")
25+
26+
if(OPENBLAS_LIB)
27+
message("Found OpenBLAS library at ${OPENBLAS_LIB}")
28+
else()
29+
find_library(BLAS_LIB
30+
NAMES blas HINTS
31+
"${BLAS_ROOT}/lib")
32+
33+
if(BLAS_LIB)
34+
message("Found BLAS library at ${BLAS_LIB}")
35+
else()
36+
message(FATAL_ERROR "No BLAS library found")
37+
endif()
38+
endif()
39+
endif()
2740
endif()
2841

2942
# METIS
3043
set(METIS_ROOT "" CACHE STRING "Root directory of METIS")
3144
message(STATUS "METIS_ROOT is " ${METIS_ROOT})
3245

33-
find_package(metis CONFIG)
46+
# If a METIS install was specified try to use it first.
47+
if (NOT (METIS_ROOT STREQUAL ""))
48+
message(STATUS "Looking for METIS CMake targets file in " ${METIS_ROOT})
49+
find_package(metis CONFIG NO_DEFAULT_PATH)
50+
else()
51+
find_package(metis CONFIG)
52+
endif()
3453

3554
if(metis_FOUND)
3655
message(STATUS "metis CMake config path: ${metis_DIR}")
@@ -49,15 +68,29 @@ else()
4968
PATHS "${METIS_ROOT}/lib" "${METIS_ROOT}/bin"
5069
NO_DEFAULT_PATH)
5170

52-
message("Found Metis library at ${METIS_LIB}")
71+
if(METIS_LIB)
72+
message("Found Metis library at ${METIS_LIB}")
73+
else()
74+
# METIS_ROOT was not successful
75+
message("Metis not found in METIS_PATH, fallback to default search.")
76+
if (NOT (METIS_ROOT STREQUAL ""))
77+
find_package(metis CONFIG)
78+
79+
if (metis_FOUND)
80+
message(STATUS "metis CMake config path: ${metis_DIR}")
81+
else()
82+
message(FATAL_ERROR "No Metis library found")
83+
endif()
84+
endif()
85+
endif()
5386
endif()
5487

5588
# GKlib optional for newer versions on ubuntu and macos
5689
set(GKLIB_ROOT "" CACHE STRING "Root directory of GKlib")
5790
if (NOT (GKLIB_ROOT STREQUAL ""))
5891
message(STATUS "GKLIB_ROOT is " ${GKLIB_ROOT})
5992

60-
find_package(GKlib CONFIG)
93+
find_package(GKlib CONFIG NO_DEFAILT_PATH)
6194

6295
if(GKlib_FOUND)
6396
message(STATUS "gklib CMake config path: ${GKlib_DIR}")
@@ -91,6 +124,18 @@ if (NOT (GKLIB_ROOT STREQUAL ""))
91124
PATHS "${GKLIB_ROOT}/lib"
92125
NO_DEFAULT_PATH)
93126

94-
message("Found GKlib library at ${GKLIB_LIB}")
127+
if(GKLIB_LIB)
128+
message("Found GKlib library at ${GKLIB_LIB}")
129+
else()
130+
# GKLIB_ROOT was not successful
131+
message("GKlib not found in GKLIB_PATH, fallback to default search.")
132+
find_package(GKlib CONFIG)
133+
134+
if (GKlib_FOUND)
135+
message(STATUS "GKlib CMake config path: ${GKlib_DIR}")
136+
else()
137+
message(FATAL_ERROR "No GKLib library found")
138+
endif()
139+
endif()
95140
endif()
96141
endif()

highs/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,20 @@ else()
192192
elseif(WIN32)
193193
target_link_libraries(highs OpenBLAS::OpenBLAS)
194194
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
195-
else()
195+
else()
196196
# LINUX
197-
if(BLAS_LIB)
198-
target_link_libraries(highs "${BLAS_LIB}")
197+
if(OpenBLAS_FOUND)
198+
target_link_libraries(highs OpenBLAS::OpenBLAS)
199+
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
199200
elseif(OPENBLAS_LIB)
200201
target_link_libraries(highs "${OPENBLAS_LIB}")
201202
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
203+
elseif(BLAS_LIB)
204+
target_link_libraries(highs "${BLAS_LIB}")
202205
else()
203206
message(FATAL_ERROR "No BLAS library available")
204-
endif(BLAS_LIB)
205-
endif(APPLE)
207+
endif()
208+
endif()
206209

207210
if(metis_FOUND)
208211
target_link_libraries(highs metis)

0 commit comments

Comments
 (0)