aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Okulist <okigan@gmail.com>2023-06-15 12:51:26 -0500
committerGitHub <noreply@github.com>2023-06-15 20:51:26 +0300
commit3559433fecedf365e7aba2fe3d5f89d9abb817c1 (patch)
tree9f6d6a3123031b28e58b405349b2e2e154afa052
parent69b34a0e80300bfb3e996983ac3ea075f5526675 (diff)
cmake : set include path for OpenBlas (#1830)
-rw-r--r--CMakeLists.txt18
1 files changed, 15 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19cd42d..de01e55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,12 +163,24 @@ if (LLAMA_BLAS)
if (BLAS_FOUND)
message(STATUS "BLAS found, Libraries: ${BLAS_LIBRARIES}")
+ # BLAS_INCLUDE_DIRS is missing in FindBLAS.cmake.
+ # see https://gitlab.kitware.com/cmake/cmake/-/issues/20268
+ find_path(BLAS_INCLUDE_DIRS
+ NAMES cblas.h
+ HINTS
+ /usr/include
+ /usr/local/include
+ /usr/include/openblas
+ )
+
+
+ message(STATUS "BLAS found, Includes: ${BLAS_INCLUDE_DIRS}")
+
add_compile_options(${BLAS_LINKER_FLAGS})
add_compile_definitions(GGML_USE_OPENBLAS)
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${BLAS_LIBRARIES})
+ set(LLAMA_EXTRA_INCLUDES ${LLAMA_EXTRA_INCLUDES} ${BLAS_INCLUDE_DIRS})
- message("${BLAS_LIBRARIES} ${BLAS_INCLUDE_DIRS}")
- include_directories(${BLAS_INCLUDE_DIRS})
else()
message(WARNING "BLAS not found, please refer to "
"https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors"
@@ -408,7 +420,7 @@ add_library(ggml OBJECT
${GGML_SOURCES_EXTRA}
)
-target_include_directories(ggml PUBLIC .)
+target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
target_compile_features(ggml PUBLIC c_std_11) # don't bump
target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})