Skip to content

Commit 3559433

Browse files
authored
cmake : set include path for OpenBlas (#1830)
1 parent 69b34a0 commit 3559433

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,24 @@ if (LLAMA_BLAS)
163163
if (BLAS_FOUND)
164164
message(STATUS "BLAS found, Libraries: ${BLAS_LIBRARIES}")
165165

166+
# BLAS_INCLUDE_DIRS is missing in FindBLAS.cmake.
167+
# see https://gitlab.kitware.com/cmake/cmake/-/issues/20268
168+
find_path(BLAS_INCLUDE_DIRS
169+
NAMES cblas.h
170+
HINTS
171+
/usr/include
172+
/usr/local/include
173+
/usr/include/openblas
174+
)
175+
176+
177+
message(STATUS "BLAS found, Includes: ${BLAS_INCLUDE_DIRS}")
178+
166179
add_compile_options(${BLAS_LINKER_FLAGS})
167180
add_compile_definitions(GGML_USE_OPENBLAS)
168181
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${BLAS_LIBRARIES})
182+
set(LLAMA_EXTRA_INCLUDES ${LLAMA_EXTRA_INCLUDES} ${BLAS_INCLUDE_DIRS})
169183

170-
message("${BLAS_LIBRARIES} ${BLAS_INCLUDE_DIRS}")
171-
include_directories(${BLAS_INCLUDE_DIRS})
172184
else()
173185
message(WARNING "BLAS not found, please refer to "
174186
"https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors"
@@ -408,7 +420,7 @@ add_library(ggml OBJECT
408420
${GGML_SOURCES_EXTRA}
409421
)
410422

411-
target_include_directories(ggml PUBLIC .)
423+
target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
412424
target_compile_features(ggml PUBLIC c_std_11) # don't bump
413425
target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})
414426

0 commit comments

Comments
 (0)