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

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

include(FetchContent)

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

# See messages during 'git clone'
set(FETCHCONTENT_QUIET FALSE)

if(NOT OpenBLAS_POPULATED)
    FetchContent_Populate(OpenBLAS)
endif()

##################
# 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()

# Build library
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: ${rv}")
endif()

#add_subdirectory(${OPENBLAS_LOCAL_PATH})

find_package(OpenBLAS)

#if(NOT OpenBLAS_FOUND)
#    message(FATAL_ERROR "OpenBLAS was not downloaded successfully!")
#endif()