Automatic Arch Linux detection for BLAS

This commit is a port of a detection method used in koboldcpp's Makefile in order to automatically set the -lcblas option on Arch Linux
This commit is contained in:
DaniAndTheWeb 2023-05-05 18:31:05 +02:00 committed by GitHub
parent 921dcee00a
commit 4e3c178be4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,15 @@ ifndef UNAME_M
UNAME_M := $(shell uname -m)
endif
ARCH_LINUX1 := $(shell grep "Arch Linux" /etc/os-release 2>/dev/null)
ARCH_LINUX2 := $(shell grep "ID_LIKE=arch" /etc/os-release 2>/dev/null)
ifdef ARCH_LINUX1
ARCH_ADD = -lcblas
endif
ifdef ARCH_LINUX2
ARCH_ADD = -lcblas
endif
CCV := $(shell $(CC) --version | head -n 1)
CXXV := $(shell $(CXX) --version | head -n 1)
@ -107,7 +116,7 @@ ifndef LLAMA_NO_ACCELERATE
endif
ifdef LLAMA_OPENBLAS
CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
LDFLAGS += -lopenblas
LDFLAGS += -lopenblas $(ARCH_ADD)
endif
ifdef LLAMA_CUBLAS
CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include