|
2 | 2 | set(BLAS_ROOT "" CACHE STRING "Root directory of BLAS or OpenBLAS") |
3 | 3 | message(STATUS "BLAS_ROOT is " ${BLAS_ROOT}) |
4 | 4 |
|
5 | | -if (WIN32) |
6 | | - if (NOT (BLAS_ROOT STREQUAL "")) |
7 | | - message(STATUS "Looking for blas in " ${BLAS_ROOT}) |
8 | | - set(OpenBLAS_ROOT ${BLAS_ROOT}) |
9 | | - message(STATUS "OpenBLAS_ROOT is ${OpenBLAS_ROOT} ") |
10 | | - find_package(OpenBLAS CONFIG NO_DEFAULT_PATH) |
11 | | - |
12 | | - if(OpenBLAS_FOUND) |
13 | | - message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}") |
14 | | - else() |
15 | | - message(STATUS "OpenBLAS not found in ${BLAS_ROOT}") |
16 | | - endif() |
| 5 | +set(BLA_VENDOR "" CACHE STRING "For blas trampoline") |
17 | 6 |
|
18 | | - endif() |
19 | | - if ((BLAS_ROOT STREQUAL "") OR (NOT OpenBLAS_FOUND)) |
20 | | - message(STATUS "Looking for blas") |
| 7 | +# Optionally set the vendor: |
| 8 | +# set(BLA_VENDOR libblastrampoline) |
21 | 9 |
|
22 | | - find_package(OpenBLAS REQUIRED) |
| 10 | +if (BLA_VENDOR STREQUAL "") |
| 11 | + if (WIN32) |
| 12 | + if (NOT (BLAS_ROOT STREQUAL "")) |
| 13 | + message(STATUS "Looking for blas in " ${BLAS_ROOT}) |
| 14 | + set(OpenBLAS_ROOT ${BLAS_ROOT}) |
| 15 | + message(STATUS "OpenBLAS_ROOT is ${OpenBLAS_ROOT} ") |
| 16 | + find_package(OpenBLAS CONFIG NO_DEFAULT_PATH) |
23 | 17 |
|
24 | | - if(OpenBLAS_FOUND) |
25 | | - if(TARGET OpenBLAS::OpenBLAS) |
| 18 | + if(OpenBLAS_FOUND) |
26 | 19 | message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}") |
27 | | - elseif(OPENBLAS_LIB) |
28 | | - message(STATUS "Linking against OpenBLAS via raw library: ${OPENBLAS_LIB}") |
29 | 20 | else() |
30 | | - message(STATUS "OpenBLAS found but no target?") |
| 21 | + message(STATUS "OpenBLAS not found in ${BLAS_ROOT}") |
31 | 22 | endif() |
32 | | - else() |
33 | | - message(FATAL_ERROR "No BLAS library found") |
34 | 23 | endif() |
35 | | - endif() |
36 | | -elseif(NOT APPLE) |
37 | | - # LINUX |
38 | 24 |
|
39 | | - # If a BLAS install was specified try to use it first. |
40 | | - if (NOT (BLAS_ROOT STREQUAL "")) |
41 | | - message(STATUS "Looking for blas in " ${BLAS_ROOT}) |
| 25 | + if ((BLAS_ROOT STREQUAL "") OR (NOT OpenBLAS_FOUND)) |
| 26 | + # (NOT OpenBLAS_FOUND AND NOT BLAS_FOUND)) |
| 27 | + message(STATUS "Looking for blas") |
| 28 | + |
| 29 | + find_package(OpenBLAS REQUIRED) |
| 30 | + |
| 31 | + if(OpenBLAS_FOUND) |
| 32 | + if(TARGET OpenBLAS::OpenBLAS) |
| 33 | + message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}") |
| 34 | + elseif(OPENBLAS_LIB) |
| 35 | + message(STATUS "Linking against OpenBLAS via raw library: ${OPENBLAS_LIB}") |
| 36 | + else() |
| 37 | + # try blas |
| 38 | + # find_package(BLAS) |
| 39 | + # if (BLAS_FOUND) |
| 40 | + # message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}") |
| 41 | + # message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}") |
| 42 | + # else() |
| 43 | + # message(STATUS "OpenBLAS found but no target?") |
| 44 | + # endif() |
| 45 | + endif() |
| 46 | + else() |
| 47 | + message(FATAL_ERROR "No BLAS library found") |
| 48 | + endif() |
| 49 | + endif() |
42 | 50 |
|
43 | | - find_library(OPENBLAS_LIB |
44 | | - NAMES openblas |
45 | | - HINTS "${BLAS_ROOT}/lib" |
46 | | - NO_DEFAULT_PATH) |
| 51 | + elseif(NOT APPLE) |
| 52 | + # LINUX |
47 | 53 |
|
48 | | - if(OPENBLAS_LIB) |
49 | | - message("Found OpenBLAS library at ${OPENBLAS_LIB}") |
50 | | - else() |
51 | | - find_library(BLAS_LIB |
52 | | - NAMES blas |
| 54 | + # If a BLAS install was specified try to use it first. |
| 55 | + if (NOT (BLAS_ROOT STREQUAL "")) |
| 56 | + message(STATUS "Looking for blas in " ${BLAS_ROOT}) |
| 57 | + |
| 58 | + find_library(OPENBLAS_LIB |
| 59 | + NAMES openblas |
53 | 60 | HINTS "${BLAS_ROOT}/lib" |
54 | 61 | NO_DEFAULT_PATH) |
55 | 62 |
|
56 | | - if(BLAS_LIB) |
57 | | - message("Found BLAS library at ${BLAS_LIB}") |
| 63 | + if(OPENBLAS_LIB) |
| 64 | + message("Found OpenBLAS library at ${OPENBLAS_LIB}") |
58 | 65 | else() |
59 | | - message("Did not find blas library at ${BLAS_ROOT}") |
60 | | - message("Attempting default locations search") |
| 66 | + find_library(BLAS_LIB |
| 67 | + NAMES blas |
| 68 | + HINTS "${BLAS_ROOT}/lib" |
| 69 | + NO_DEFAULT_PATH) |
| 70 | + |
| 71 | + if(BLAS_LIB) |
| 72 | + message("Found BLAS library at ${BLAS_LIB}") |
| 73 | + else() |
| 74 | + message("Did not find blas library at ${BLAS_ROOT}") |
| 75 | + message("Attempting default locations search") |
| 76 | + endif() |
61 | 77 | endif() |
62 | 78 | endif() |
63 | | - endif() |
64 | | - if ((BLAS_ROOT STREQUAL "") OR (NOT OPENBLAS_LIB AND NOT BLAS_LIB)) |
| 79 | + if ((BLAS_ROOT STREQUAL "") OR (NOT OPENBLAS_LIB AND NOT BLAS_LIB)) |
65 | 80 |
|
66 | | - find_library(OPENBLAS_LIB |
67 | | - NAMES openblas |
68 | | - HINTS "${BLAS_ROOT}/lib") |
69 | | - |
70 | | - if(OPENBLAS_LIB) |
71 | | - message("Found OpenBLAS library at ${OPENBLAS_LIB}") |
72 | | - else() |
73 | | - find_library(BLAS_LIB |
74 | | - NAMES blas |
| 81 | + find_library(OPENBLAS_LIB |
| 82 | + NAMES openblas |
75 | 83 | HINTS "${BLAS_ROOT}/lib") |
76 | 84 |
|
77 | | - if(BLAS_LIB) |
78 | | - message("Found BLAS library at ${BLAS_LIB}") |
| 85 | + if(OPENBLAS_LIB) |
| 86 | + message("Found OpenBLAS library at ${OPENBLAS_LIB}") |
79 | 87 | else() |
80 | | - message(FATAL_ERROR "No BLAS library found") |
| 88 | + find_library(BLAS_LIB |
| 89 | + NAMES blas |
| 90 | + HINTS "${BLAS_ROOT}/lib") |
| 91 | + |
| 92 | + if(BLAS_LIB) |
| 93 | + message("Found BLAS library at ${BLAS_LIB}") |
| 94 | + else() |
| 95 | + message(FATAL_ERROR "No BLAS library found") |
| 96 | + endif() |
81 | 97 | endif() |
82 | 98 | endif() |
83 | 99 | endif() |
| 100 | +else() |
| 101 | + # if (NOT BLA_VENDOR STREQUALS "") |
| 102 | + find_package(BLAS REQUIRED) |
| 103 | + if (BLAS_FOUND) |
| 104 | + message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}") |
| 105 | + message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}") |
| 106 | + else() |
| 107 | + message(FATAL_ERROR "No BLAS library found!") |
| 108 | + endif() |
84 | 109 | endif() |
85 | 110 |
|
86 | 111 | # METIS |
|
0 commit comments