Skip to content
Snippets Groups Projects
DownloadOpenBLAS.cmake 1.16 KiB
message("DownloadOpenBLAS starting...")

set(OPENBLAS_LOCAL_PATH ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/OpenBLAS)

include(FetchContent)

#####################
# Download OpenBLAS #
#####################
FetchContent_Declare(
    OpenBLAS
    SOURCE_DIR ${OPENBLAS_LOCAL_PATH}
    GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git
)

set(FETCHCONTENT_QUIET FALSE)

FetchContent_Populate(OpenBLAS)

##################
# Build OpenBLAS #
##################
#execute_process(
#    COMMAND cmake -j ${N_CORES} .
#    WORKING_DIRECTORY ${OPENBLAS_LOCAL_PATH}
#    RESULT_VARIABLE rv
#)
#if(NOT rv STREQUAL "0")
#    message("OpenBLAS build: cmake .: ${rv}")
#endif()
#
#execute_process(
#    COMMAND cmake --build . -j ${N_CORES} --config Release
#    WORKING_DIRECTORY ${OPENBLAS_LOCAL_PATH}
#    RESULT_VARIABLE rv
#)
#if(NOT rv STREQUAL "0")
#    message("OpenBLAS build: cmake --build . -j ${N_CORES}: ${rv}")
#endif()

set(OpenBLAS_DIR ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/OpenBLAS)
find_package(OpenBLAS)

if(NOT BLAS_FOUND)
    message(FATAL_ERROR "OpenBLAS was not downloaded successfully!")
else()
    message("OpenBLAS libraries: " ${BLAS_LIBRARIES})
endif()