| 1 |
# @HEADER |
| 2 |
# ***************************************************************************** |
| 3 |
# Trilinos: An Object-Oriented Solver Framework |
| 4 |
# |
| 5 |
# Copyright 2001-2024 NTESS and the Trilinos contributors. |
| 6 |
# SPDX-License-Identifier: BSD-3-Clause |
| 7 |
# ***************************************************************************** |
| 8 |
# @HEADER |
| 9 |
|
| 10 |
|
| 11 |
set(REQUIRED_LIBS_NAMES "blas blas_win32 openblas") |
| 12 |
|
| 13 |
# |
| 14 |
# Second, search for BLAS components (if allowed) using the standard |
| 15 |
# find_package(BLAS ...). |
| 16 |
# |
| 17 |
tribits_tpl_allow_pre_find_package(BLAS BLAS_ALLOW_PREFIND) |
| 18 |
if (BLAS_ALLOW_PREFIND) |
| 19 |
|
| 20 |
message("-- Using find_package(BLAS ...) ...") |
| 21 |
|
| 22 |
find_package(BLAS) |
| 23 |
|
| 24 |
if (BLAS_FOUND) |
| 25 |
# Tell TriBITS that we found BLAS and there no need to look any further! |
| 26 |
set(TPL_BLAS_INCLUDE_DIRS "" CACHE PATH |
| 27 |
"BLAS include dirs") |
| 28 |
set(TPL_BLAS_LIBRARIES ${BLAS_LIBRARIES} CACHE FILEPATH |
| 29 |
"BLAS libraries") |
| 30 |
set(TPL_BLAS_LIBRARY_DIRS "" CACHE PATH |
| 31 |
"BLAS library dirs") |
| 32 |
endif() |
| 33 |
|
| 34 |
endif() |
| 35 |
|
| 36 |
if (MSVC AND NOT |
| 37 |
(BLAS_LIBRARY_DIRS OR |
| 38 |
(NOT "${BLAS_LIBRARY_NAMES}" STREQUAL "blas blas_win32" AND |
| 39 |
NOT "${BLAS_LIBRARY_NAMES}" STREQUAL "") OR |
| 40 |
BLAS_INCLUDE_DIRS OR |
| 41 |
BLAS_INCLUDE_NAMES OR |
| 42 |
(NOT "${TPL_BLAS_LIBRARIES}" STREQUAL "blas" AND |
| 43 |
NOT "${TPL_BLAS_LIBRARIES}" STREQUAL "") OR |
| 44 |
TPL_BLAS_INCLUDE_DIRS) |
| 45 |
) |
| 46 |
# Find the CLAPACK built by CMake on the machine for MSVC if found it will |
| 47 |
# set the BLAS and LAPACK libraries. NOTE: This the FindCLAPACK module must |
| 48 |
# be called every configure or this does not work! |
| 49 |
# If the user has specified alternate name or location of their blas that |
| 50 |
# will be used instead. |
| 51 |
find_package(CLAPACK 3.2.1 NO_MODULE) |
| 52 |
if (CLAPACK_FOUND) |
| 53 |
advanced_set(TPL_BLAS_LIBRARIES blas |
| 54 |
CACHE FILEPATH "Set from MSVC CLAPACK specialization") |
| 55 |
endif() |
| 56 |
endif() |
| 57 |
# |
| 58 |
# Third, call tribits_tpl_find_include_dirs_and_libraries() |
| 59 |
# |
| 60 |
tribits_tpl_find_include_dirs_and_libraries( BLAS |
| 61 |
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} |
| 62 |
) |
| 63 |
# NOTE: If find_package(BLAS ...) was called and successfully found BLAS, then |
| 64 |
# tribits_tpl_find_include_dirs_and_libraries() will use the already-set |
| 65 |
# variables TPL_BLAS_INCLUDE_DIRS and TPL_BLAS_LIBRARIES and then print them |