From f9cd7c586d0e4275b579f7d94e738f96e367fe64 Mon Sep 17 00:00:00 2001 From: Martin Beseda <martin.beseda@vsb.cz> Date: Tue, 19 Feb 2019 13:50:52 +0100 Subject: [PATCH] FIX: Trying to fix OpenBlass download --- CMakeLists.txt | 3 ++- DownloadOpenBLAS.cmake | 36 ++++++++++++++--------------- FindOpenBLAS.cmake | 52 +++++++++++++++--------------------------- 3 files changed, 38 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eaafb9f3..3ad955a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,8 @@ endif() message("Checking Armadillo dependencies") find_package(LAPACK) find_package(BLAS) -if(NOT LAPACK_FOUND AND NOT BLAS_FOUND AND ALLOW_DEPENDENCIES_DOWNLOAD) +find_package(OpenBLAS) +if(NOT LAPACK_FOUND AND NOT BLAS_FOUND AND NOT OpenBLAS_FOUND AND ALLOW_DEPENDENCIES_DOWNLOAD) # Download and build OpenBLAS locally message("LAPACK nor BLAS were found - OpenBLAS will be downloaded and built.") include(DownloadOpenBLAS) diff --git a/DownloadOpenBLAS.cmake b/DownloadOpenBLAS.cmake index 51896616..edb794b9 100644 --- a/DownloadOpenBLAS.cmake +++ b/DownloadOpenBLAS.cmake @@ -20,23 +20,23 @@ 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() +#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) @@ -44,6 +44,6 @@ find_package(OpenBLAS) if(NOT BLAS_FOUND) message(FATAL_ERROR "OpenBLAS was not downloaded successfully!") else() - message("OpenBLAS libraries: "${BLAS_LIBRARIES}) + message("OpenBLAS libraries: " ${BLAS_LIBRARIES}) endif() diff --git a/FindOpenBLAS.cmake b/FindOpenBLAS.cmake index 7ba84591..506c0157 100644 --- a/FindOpenBLAS.cmake +++ b/FindOpenBLAS.cmake @@ -1,47 +1,31 @@ message("FindOpenBLAS starting...") -SET(Open_BLAS_INCLUDE_SEARCH_PATHS - ${OpenBLAS_INCLUDE_DIRECTORY} - $ENV{OpenBLAS_INCLUDE_DIRECTORY} - /usr/include - /usr/include/openblas - /usr/include/openblas-base - /usr/local/include - /usr/local/include/openblas - /usr/local/include/openblas-base - /opt/OpenBLAS/include - ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/OpenBLAS - ) +set(OpenBLAS_ROOT external_dependencies/OpenBLAS) -SET(Open_BLAS_LIB_SEARCH_PATHS - ${OpenBLAS_LIBRARY_DIRECTORY} - $ENV{OpenBLAS_LIBRARY_DIRECTORY} - /lib/ - /lib/openblas-base - /lib64/ - /usr/lib - /usr/lib/openblas-base - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/OpenBLAS/lib - ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/OpenBLAS/lib - ) +FIND_PATH( + OpenBLAS_INCLUDE_DIR -FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h - PATHS - ${Open_BLAS_INCLUDE_SEARCH_PATHS} + HINTS + ${OpenBLAS_INCLUDE_DIRECTORY} + $ENV{OpenBLAS_INCLUDE_DIRECTORY} + /usr/include/ + /usr/include/x86_64-linux-gnu + external_dependencies/OpenBLAS ) FIND_LIBRARY(OpenBLAS_LIBRARIES NAMES - openblas - - PATHS - ${Open_BLAS_LIB_SEARCH_PATHS} + ${LIB_PREFIX}openblas.${LIB_SUFFIX} + + HINTS + ${OpenBLAS_LIBRARY_DIRECTORY} + $ENV{OpenBLAS_LIBRARY_DIRECTORY} + /usr/lib + /usr/lib/x86_64-linux-gnu + external_dependencies/OpenBLAS/lib ) # Set OpenBLAS_Found @@ -54,7 +38,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( REQUIRED_VARS OpenBLAS_INCLUDE_DIR - OpenBLAS_LIBRARY_DIR + OpenBLAS_LIBRARIES ) IF (OpenBLAS_FOUND) -- GitLab