Skip to content

Commit

Permalink
Drop LAPACK requirement and let Suitesparse use OpenBLAS
Browse files Browse the repository at this point in the history
  • Loading branch information
dstoup committed Apr 16, 2021
1 parent 8b7964c commit 4b5512a
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions CMake/External_SuiteSparse.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,31 @@ if (BUILD_CXSPARSE_ONLY)
)

elseif (NOT WIN32 AND NOT BUILD_CXSPARSE_ONLY)

find_package(LAPACK)
find_package(LAPACK QUIET)
if (NOT LAPACK_FOUND)
list (APPEND MISSING_DEPS "lapack")
endif()

find_package(BLAS)
if (NOT BLAS_FOUND)
add_package_dependency(
PACKAGE SuiteSparse
PACKAGE_DEPENDENCY OpenBLAS
PACKAGE_DEPENDENCY_ALIAS OpenBLAS
)
if(fletch_ENABLE_OpenBLAS)
# If we are building OpenBLAS, make sure we have a fortran compiler.
enable_language(Fortran)
add_package_dependency(
PACKAGE SuiteSparse
PACKAGE_DEPENDENCY OpenBLAS
PACKAGE_DEPENDENCY_ALIAS OpenBLAS
)
get_system_library_name(openblas openblas_libname)
set(BLAS_LIBRARIES ${fletch_BUILD_INSTALL_PREFIX}/lib/${openblas_libname})
set(env ${CMAKE_COMMAND} -E env)
message("env = ${env}")
set(env_var LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${fletch_BUILD_INSTALL_PREFIX}/lib)
message("env_var = ${env_var}")
set(ENV_CMD ${env} ${env_var})

else()
find_package(BLAS QUIET)
if (NOT BLAS_FOUND)
message(FATAL_ERROR "Building SuiteSparse requires LAPACK or BLAS. \
Please install or enable OpenBLAS in the Fletch CMake config.")
endif()
endif()
endif()

if (MISSING_DEPS)
Expand Down Expand Up @@ -89,7 +101,7 @@ elseif (NOT WIN32 AND NOT BUILD_CXSPARSE_ONLY)
-P ${fletch_SOURCE_DIR}/Patches/SuiteSparse/Patch.cmake

CONFIGURE_COMMAND ""
BUILD_COMMAND ${MAKE_EXECUTABLE} -j1
BUILD_COMMAND ${ENV_CMD} ${MAKE_EXECUTABLE} -j1
INSTALL_COMMAND ${MAKE_EXECUTABLE} install
)

Expand Down

0 comments on commit 4b5512a

Please sign in to comment.