Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 33 additions & 24 deletions cmake/FindHipoDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,37 +101,46 @@ if (NOT USE_CMAKE_FIND_BLAS)
endif()
else()

if (NOT BLA_VENDOR)
if (APPLE)
set (BLA_VENDOR Apple)
elseif(LINUX)
set (BLA_VENDOR OpenBLAS)
elseif(WIN32)
set (BLA_VENDOR OpenBLAS)
if (WIN32 AND NOT BLAS_LIBRARIES AND NOT BLA_VENDOR)
find_package(OpenBLAS CONFIG)
if(OpenBLAS_FOUND)
message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}")
endif()
endif()

if (NOT OpenBLAS_FOUND)
if (NOT BLA_VENDOR)
if (APPLE)
set (BLA_VENDOR Apple)
elseif(LINUX)
set (BLA_VENDOR OpenBLAS)
elseif(WIN32)
set (BLA_VENDOR OpenBLAS)
endif()

find_package(BLAS QUIET)
if (BLAS_FOUND)
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
if (BLAS_INCLUDE_DIRS)
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
find_package(BLAS QUIET)
if (BLAS_FOUND)
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
if (BLAS_INCLUDE_DIRS)
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
endif()
else()
unset(BLA_VENDOR)
endif()
else()
unset(BLA_VENDOR)
message(STATUS "Specified BLA_VENDOR: ${BLA_VENDOR}")
endif()
else()
message(STATUS "Specified BLA_VENDOR: ${BLA_VENDOR}")
endif()

if (NOT BLAS_FOUND)
find_package(BLAS REQUIRED)
if (BLAS_FOUND)
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
if (BLAS_INCLUDE_DIRS)
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
if (NOT BLAS_FOUND)
find_package(BLAS REQUIRED)
if (BLAS_FOUND)
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
if (BLAS_INCLUDE_DIRS)
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
endif()
else()
message(FATAL_ERROR "No BLAS library found!")
endif()
else()
message(FATAL_ERROR "No BLAS library found!")
endif()
endif()
endif()
Expand Down
16 changes: 11 additions & 5 deletions highs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,19 @@ else()
endif(BLAS_LIB)
endif(APPLE)
else()
target_link_libraries(highs PRIVATE BLAS::BLAS)

string(TOLOWER "${BLAS_LIBRARIES}" blas_lower)
if(blas_lower MATCHES "openblas")
if (WIN32 AND TARGET OpenBLAS::OpenBLAS)
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
elseif(blas_lower MATCHES "accelerate")
target_compile_definitions(highs PRIVATE HIPO_USES_APPLE_BLAS)
target_link_libraries(highs PRIVATE OpenBLAS::OpenBLAS)
else()
target_link_libraries(highs PRIVATE BLAS::BLAS)

string(TOLOWER "${BLAS_LIBRARIES}" blas_lower)
if(blas_lower MATCHES "openblas")
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
elseif(blas_lower MATCHES "accelerate")
target_compile_definitions(highs PRIVATE HIPO_USES_APPLE_BLAS)
endif()
endif()
endif()

Expand Down
Loading