diff -Naur armadillo-9.900.2/cmake_aux/Modules/ARMA_FindFlexiBLAS.cmake armadillo-9.900.2-flexiblas/cmake_aux/Modules/ARMA_FindFlexiBLAS.cmake --- armadillo-9.900.2/cmake_aux/Modules/ARMA_FindFlexiBLAS.cmake 1970-01-01 10:00:00.000000000 +1000 +++ armadillo-9.900.2-flexiblas/cmake_aux/Modules/ARMA_FindFlexiBLAS.cmake 2020-08-05 19:53:10.573438536 +1000 @@ -0,0 +1,48 @@ +set(FlexiBLAS_NAMES) +set(FlexiBLAS_NAMES ${FlexiBLAS_NAMES} flexiblas) + +set(FlexiBLAS_TMP_LIBRARY) +set(FlexiBLAS_TMP_LIBRARIES) + + +foreach (FlexiBLAS_NAME ${FlexiBLAS_NAMES}) + find_library(${FlexiBLAS_NAME}_LIBRARY + NAMES ${FlexiBLAS_NAME} + PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 /opt/local/lib + ) + + set(FlexiBLAS_TMP_LIBRARY ${${FlexiBLAS_NAME}_LIBRARY}) + + if(FlexiBLAS_TMP_LIBRARY) + set(FlexiBLAS_TMP_LIBRARIES ${FlexiBLAS_TMP_LIBRARIES} ${FlexiBLAS_TMP_LIBRARY}) + endif() +endforeach() + + +# use only one library + +if(FlexiBLAS_TMP_LIBRARIES) + list(GET FlexiBLAS_TMP_LIBRARIES 0 FlexiBLAS_LIBRARY) +endif() + + +if(FlexiBLAS_LIBRARY) + set(FlexiBLAS_LIBRARIES ${FlexiBLAS_LIBRARY}) + set(FlexiBLAS_FOUND "YES") +else() + set(FlexiBLAS_FOUND "NO") +endif() + + +if(FlexiBLAS_FOUND) + if (NOT FlexiBLAS_FIND_QUIETLY) + message(STATUS "Found FlexiBLAS: ${FlexiBLAS_LIBRARIES}") + endif() +else() + if(FlexiBLAS_FIND_REQUIRED) + message(FATAL_ERROR "Could not find FlexiBLAS") + endif() +endif() + + +# mark_as_advanced(FlexiBLAS_LIBRARY) diff -Naur armadillo-9.900.2/CMakeLists.txt armadillo-9.900.2-flexiblas/CMakeLists.txt --- armadillo-9.900.2/CMakeLists.txt 2016-06-17 02:21:12.000000000 +1000 +++ armadillo-9.900.2-flexiblas/CMakeLists.txt 2020-08-05 19:52:44.000439011 +1000 @@ -134,6 +134,10 @@ option(DETECT_HDF5 "Detect HDF5 and include HDF5 support, if found" ON) +option(ALLOW_FLEXIBLAS_LINUX "Allow detection of FlexiBLAS on Linux (EXPERIMENTAL)" OFF) +## Example use on the command line: +## cmake -D ALLOW_FLEXIBLAS_LINUX=true . + option(ALLOW_OPENBLAS_MACOS "Allow detection of OpenBLAS on macOS" OFF) ## Example use on the command line: ## cmake -D ALLOW_OPENBLAS_MACOS=true . @@ -171,6 +175,7 @@ message(STATUS "CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}" ) message(STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" ) message(STATUS "DETECT_HDF5 = ${DETECT_HDF5}" ) +message(STATUS "ALLOW_FLEXIBLAS_LINUX = ${ALLOW_FLEXIBLAS_LINUX}" ) message(STATUS "ALLOW_OPENBLAS_MACOS = ${ALLOW_OPENBLAS_MACOS}" ) message(STATUS "ALLOW_BLAS_LAPACK_MACOS = ${ALLOW_BLAS_LAPACK_MACOS}" ) message(STATUS "BUILD_SMOKE_TEST = ${BUILD_SMOKE_TEST}" ) @@ -259,15 +264,39 @@ include(ARMA_FindBLAS) include(ARMA_FindLAPACK) - message(STATUS " MKL_FOUND = ${MKL_FOUND}" ) - message(STATUS " ACMLMP_FOUND = ${ACMLMP_FOUND}" ) - message(STATUS " ACML_FOUND = ${ACML_FOUND}" ) - message(STATUS "OpenBLAS_FOUND = ${OpenBLAS_FOUND}") - message(STATUS " ATLAS_FOUND = ${ATLAS_FOUND}" ) - message(STATUS " BLAS_FOUND = ${BLAS_FOUND}" ) - message(STATUS " LAPACK_FOUND = ${LAPACK_FOUND}" ) + if(ALLOW_FLEXIBLAS_LINUX AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) + include(ARMA_FindFlexiBLAS) + endif() + + message(STATUS " MKL_FOUND = ${MKL_FOUND}" ) + message(STATUS " ACMLMP_FOUND = ${ACMLMP_FOUND}" ) + message(STATUS " ACML_FOUND = ${ACML_FOUND}" ) + message(STATUS " OpenBLAS_FOUND = ${OpenBLAS_FOUND}" ) + message(STATUS " ATLAS_FOUND = ${ATLAS_FOUND}" ) + message(STATUS " BLAS_FOUND = ${BLAS_FOUND}" ) + message(STATUS " LAPACK_FOUND = ${LAPACK_FOUND}" ) - if(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND) + if(FlexiBLAS_FOUND) + + message(STATUS "FlexiBLAS_FOUND = ${FlexiBLAS_FOUND}" ) + + set(ARMA_USE_LAPACK true) + set(ARMA_USE_BLAS true) + + set(ARMA_LIBS ${ARMA_LIBS} ${FlexiBLAS_LIBRARIES}) + + message(STATUS "") + message(STATUS "*** Using FlexiBLAS to provide BLAS and LAPACK functions.") + message(STATUS "*** If using FlexiBLAS causes problems, please file a bug") + message(STATUS "*** report with the FlexiBLAS developers:") + message(STATUS "*** https://www.mpi-magdeburg.mpg.de/projects/flexiblas") + message(STATUS "") + message(STATUS "*** To disable detection of FlexiBLAS,") + message(STATUS "*** rerun cmake with FlexiBLAS detection disabled:") + message(STATUS "*** cmake -D ALLOW_FLEXIBLAS_LINUX=false .") + message(STATUS "") + + elseif(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND) set(ARMA_USE_LAPACK true) set(ARMA_USE_BLAS true)