diff options
Diffstat (limited to 'Modules/FindLAPACK.cmake')
-rw-r--r-- | Modules/FindLAPACK.cmake | 108 |
1 files changed, 92 insertions, 16 deletions
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 4b71cee..45e4be7 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -43,14 +43,46 @@ The following variables may be set to influence this module's behavior: * ``Arm_mp`` * ``Arm_ilp64`` * ``Arm_ilp64_mp`` + * ``EML`` + * ``EML_mt`` * ``Generic`` + .. versionadded:: 3.6 + ``OpenBLAS`` support. + + .. versionadded:: 3.11 + ``FLAME`` support. + + .. versionadded:: 3.13 + Added ILP64 MKL variants (``Intel10_64ilp``, ``Intel10_64ilp_seq``). + + .. versionadded:: 3.17 + Added single dynamic library MKL variant (``Intel10_64_dyn``). + + .. versionadded:: 3.18 + Arm Performance Libraries support (``Arm``, ``Arm_mp``, ``Arm_ilp64``, + ``Arm_ilp64_mp``). + + .. versionadded:: 3.19 + ``FlexiBLAS`` support. + + .. versionadded:: 3.20 + Elbrus Math Library support (``EML``, ``EML_mt``). + ``BLA_F95`` if ``ON`` tries to find the BLAS95/LAPACK95 interfaces +``BLA_PREFER_PKGCONFIG`` + .. versionadded:: 3.20 + + if set ``pkg-config`` will be used to search for a LAPACK library first + and if one is found that is preferred + Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.18 + This module defines the following :prop_tgt:`IMPORTED` target: ``LAPACK::LAPACK`` @@ -95,6 +127,26 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +function(_add_lapack_target) + if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK) + add_library(LAPACK::LAPACK INTERFACE IMPORTED) + set(_lapack_libs "${LAPACK_LIBRARIES}") + if(_lapack_libs AND TARGET BLAS::BLAS) + # remove the ${BLAS_LIBRARIES} from the interface and replace it + # with the BLAS::BLAS target + list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}") + list(APPEND _lapack_libs BLAS::BLAS) + endif() + + if(_lapack_libs) + set_target_properties(LAPACK::LAPACK PROPERTIES + INTERFACE_LINK_LIBRARIES "${_lapack_libs}" + ) + endif() + unset(_lapack_libs) + endif() +endfunction() + macro(_lapack_find_library_setup) cmake_push_check_state() set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) @@ -239,6 +291,21 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) _lapack_find_dependency(BLAS) endif() +# Search with pkg-config if specified +if(BLA_PREFER_PKGCONFIG) + find_package(PkgConfig) + pkg_check_modules(PKGC_LAPACK lapack) + if(PKGC_LAPACK_FOUND) + set(LAPACK_FOUND TRUE) + set(LAPACK_LIBRARIES "${PKGC_LAPACK_LINK_LIBRARIES}") + if (BLAS_LIBRARIES) + list(APPEND LAPACK_LIBRARIES "${BLAS_LIBRARIES}") + endif() + _add_lapack_target() + return() + endif() +endif() + # Search for different LAPACK distributions if BLAS is found if(NOT LAPACK_NOT_FOUND_MESSAGE) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) @@ -494,6 +561,30 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) ) endif() + # Elbrus Math Library? + if(NOT LAPACK_LIBRARIES + AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")) + + set(LAPACK_EML_LIB "eml") + + # Check for OpenMP support, VIA BLA_VENDOR of eml_mt + if(BLA_VENDOR MATCHES "_mt") + set(LAPACK_EML_LIB "${LAPACK_EML_LIB}_mt") + endif() + + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "${LAPACK_EML_LIB}" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() + # Generic LAPACK library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "Generic" @@ -535,21 +626,6 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") set(LAPACK_LIBRARIES "") endif() -if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK) - add_library(LAPACK::LAPACK INTERFACE IMPORTED) - set(_lapack_libs "${LAPACK_LIBRARIES}") - if(_lapack_libs AND TARGET BLAS::BLAS) - # remove the ${BLAS_LIBRARIES} from the interface and replace it - # with the BLAS::BLAS target - list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}") - endif() - - if(_lapack_libs) - set_target_properties(LAPACK::LAPACK PROPERTIES - INTERFACE_LINK_LIBRARIES "${_lapack_libs}" - ) - endif() - unset(_lapack_libs) -endif() +_add_lapack_target() _lapack_find_library_teardown() |