mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-13 04:00:16 +00:00
Add required ggml-base and backend libs to cmake pkg (#10407)
Some checks are pending
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full-cuda.Dockerfile platforms:linux/amd64 tag:full-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full-musa.Dockerfile platforms:linux/amd64 tag:full-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full.Dockerfile platforms:linux/amd64,linux/arm64 tag:full]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-cuda.Dockerfile platforms:linux/amd64 tag:light-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-intel.Dockerfile platforms:linux/amd64 tag:light-intel]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-musa.Dockerfile platforms:linux/amd64 tag:light-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli.Dockerfile platforms:linux/amd64,linux/arm64 tag:light]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-cuda.Dockerfile platforms:linux/amd64 tag:server-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-intel.Dockerfile platforms:linux/amd64 tag:server-intel]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-musa.Dockerfile platforms:linux/amd64 tag:server-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server.Dockerfile platforms:linux/amd64,linux/arm64 tag:server]) (push) Waiting to run
Nix CI / nix-eval (macos-latest) (push) Waiting to run
Nix CI / nix-eval (ubuntu-latest) (push) Waiting to run
Nix CI / nix-build (macos-latest) (push) Waiting to run
Nix CI / nix-build (ubuntu-latest) (push) Waiting to run
flake8 Lint / Lint (push) Waiting to run
Some checks are pending
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full-cuda.Dockerfile platforms:linux/amd64 tag:full-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full-musa.Dockerfile platforms:linux/amd64 tag:full-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/full.Dockerfile platforms:linux/amd64,linux/arm64 tag:full]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-cuda.Dockerfile platforms:linux/amd64 tag:light-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-intel.Dockerfile platforms:linux/amd64 tag:light-intel]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli-musa.Dockerfile platforms:linux/amd64 tag:light-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-cli.Dockerfile platforms:linux/amd64,linux/arm64 tag:light]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-cuda.Dockerfile platforms:linux/amd64 tag:server-cuda]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-intel.Dockerfile platforms:linux/amd64 tag:server-intel]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server-musa.Dockerfile platforms:linux/amd64 tag:server-musa]) (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (map[dockerfile:.devops/llama-server.Dockerfile platforms:linux/amd64,linux/arm64 tag:server]) (push) Waiting to run
Nix CI / nix-eval (macos-latest) (push) Waiting to run
Nix CI / nix-eval (ubuntu-latest) (push) Waiting to run
Nix CI / nix-build (macos-latest) (push) Waiting to run
Nix CI / nix-build (ubuntu-latest) (push) Waiting to run
flake8 Lint / Lint (push) Waiting to run
This commit is contained in:
parent
3ee6382d48
commit
2a11b6b094
@ -3,17 +3,11 @@ set(LLAMA_BUILD_COMMIT @LLAMA_BUILD_COMMIT@)
|
|||||||
set(LLAMA_BUILD_NUMBER @LLAMA_BUILD_NUMBER@)
|
set(LLAMA_BUILD_NUMBER @LLAMA_BUILD_NUMBER@)
|
||||||
set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@)
|
set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@)
|
||||||
|
|
||||||
set(GGML_BLAS @GGML_BLAS@)
|
|
||||||
set(GGML_CUDA @GGML_CUDA@)
|
|
||||||
set(GGML_METAL @GGML_METAL@)
|
|
||||||
set(GGML_HIP @GGML_HIP@)
|
|
||||||
set(GGML_ACCELERATE @GGML_ACCELERATE@)
|
set(GGML_ACCELERATE @GGML_ACCELERATE@)
|
||||||
set(GGML_VULKAN @GGML_VULKAN@)
|
|
||||||
set(GGML_VULKAN_CHECK_RESULTS @GGML_VULKAN_CHECK_RESULTS@)
|
set(GGML_VULKAN_CHECK_RESULTS @GGML_VULKAN_CHECK_RESULTS@)
|
||||||
set(GGML_VULKAN_DEBUG @GGML_VULKAN_DEBUG@)
|
set(GGML_VULKAN_DEBUG @GGML_VULKAN_DEBUG@)
|
||||||
set(GGML_VULKAN_MEMORY_DEBUG @GGML_VULKAN_MEMORY_DEBUG@)
|
set(GGML_VULKAN_MEMORY_DEBUG @GGML_VULKAN_MEMORY_DEBUG@)
|
||||||
set(GGML_VULKAN_VALIDATE @GGML_VULKAN_VALIDATE@)
|
set(GGML_VULKAN_VALIDATE @GGML_VULKAN_VALIDATE@)
|
||||||
set(GGML_SYCL @GGML_SYCL@)
|
|
||||||
set(GGML_OPENMP @GGML_OPENMP@)
|
set(GGML_OPENMP @GGML_OPENMP@)
|
||||||
|
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
@ -22,10 +16,39 @@ set_and_check(LLAMA_INCLUDE_DIR "@PACKAGE_LLAMA_INCLUDE_INSTALL_DIR@")
|
|||||||
set_and_check(LLAMA_LIB_DIR "@PACKAGE_LLAMA_LIB_INSTALL_DIR@")
|
set_and_check(LLAMA_LIB_DIR "@PACKAGE_LLAMA_LIB_INSTALL_DIR@")
|
||||||
set_and_check(LLAMA_BIN_DIR "@PACKAGE_LLAMA_BIN_INSTALL_DIR@")
|
set_and_check(LLAMA_BIN_DIR "@PACKAGE_LLAMA_BIN_INSTALL_DIR@")
|
||||||
|
|
||||||
# Ensure transient dependencies satisfied
|
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
set(_llama_transient_defines "@GGML_TRANSIENT_DEFINES@")
|
||||||
|
set(_llama_link_deps "")
|
||||||
|
foreach(_ggml_lib ggml ggml-base)
|
||||||
|
string(REPLACE "-" "_" _ggml_lib_var "${_ggml_lib}_LIBRARY")
|
||||||
|
find_library(${_ggml_lib_var} ${_ggml_lib}
|
||||||
|
REQUIRED
|
||||||
|
HINTS ${LLAMA_LIB_DIR}
|
||||||
|
NO_CMAKE_FIND_ROOT_PATH
|
||||||
|
)
|
||||||
|
list(APPEND _llama_link_deps "${${_ggml_lib_var}}")
|
||||||
|
message(STATUS "Found ${${_ggml_lib_var}}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(backend amx blas cann cpu cuda hip kompute metal musa rpc sycl vulkan)
|
||||||
|
string(TOUPPER "GGML_${backend}" backend_id)
|
||||||
|
set(_ggml_lib "ggml-${backend}")
|
||||||
|
string(REPLACE "-" "_" _ggml_lib_var "${_ggml_lib}_LIBRARY")
|
||||||
|
|
||||||
|
find_library(${_ggml_lib_var} ${_ggml_lib}
|
||||||
|
HINTS ${LLAMA_LIB_DIR}
|
||||||
|
NO_CMAKE_FIND_ROOT_PATH
|
||||||
|
)
|
||||||
|
if(${_ggml_lib_var})
|
||||||
|
list(APPEND _llama_link_deps "${${_ggml_lib_var}}")
|
||||||
|
set(${backend_id} ON)
|
||||||
|
message(STATUS "Found backend ${${_ggml_lib_var}}")
|
||||||
|
else()
|
||||||
|
set(${backend_id} OFF)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
if (APPLE AND GGML_ACCELERATE)
|
if (APPLE AND GGML_ACCELERATE)
|
||||||
find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)
|
find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
@ -48,7 +71,7 @@ if (GGML_VULKAN)
|
|||||||
find_package(Vulkan REQUIRED)
|
find_package(Vulkan REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GGML_HIPBLAS)
|
if (GGML_HIP)
|
||||||
find_package(hip REQUIRED)
|
find_package(hip REQUIRED)
|
||||||
find_package(hipblas REQUIRED)
|
find_package(hipblas REQUIRED)
|
||||||
find_package(rocblas REQUIRED)
|
find_package(rocblas REQUIRED)
|
||||||
@ -63,24 +86,13 @@ if (GGML_OPENMP)
|
|||||||
find_package(OpenMP REQUIRED)
|
find_package(OpenMP REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
find_library(ggml_LIBRARY ggml
|
|
||||||
REQUIRED
|
|
||||||
HINTS ${LLAMA_LIB_DIR}
|
|
||||||
NO_CMAKE_FIND_ROOT_PATH
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(llama_LIBRARY llama
|
find_library(llama_LIBRARY llama
|
||||||
REQUIRED
|
REQUIRED
|
||||||
HINTS ${LLAMA_LIB_DIR}
|
HINTS ${LLAMA_LIB_DIR}
|
||||||
NO_CMAKE_FIND_ROOT_PATH
|
NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
set(_llama_link_deps "${ggml_LIBRARY}" "@GGML_LINK_LIBRARIES@")
|
|
||||||
set(_llama_transient_defines "@GGML_TRANSIENT_DEFINES@")
|
|
||||||
|
|
||||||
add_library(llama UNKNOWN IMPORTED)
|
add_library(llama UNKNOWN IMPORTED)
|
||||||
|
|
||||||
set_target_properties(llama
|
set_target_properties(llama
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
|
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
|
||||||
|
@ -235,12 +235,8 @@ set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}")
|
|||||||
#if (GGML_METAL)
|
#if (GGML_METAL)
|
||||||
# set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
|
# set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
|
||||||
#endif()
|
#endif()
|
||||||
install(TARGETS ggml PUBLIC_HEADER)
|
install(TARGETS ggml LIBRARY PUBLIC_HEADER)
|
||||||
|
install(TARGETS ggml-base LIBRARY)
|
||||||
if (BUILD_SHARED_LIBS)
|
|
||||||
install(TARGETS ggml LIBRARY)
|
|
||||||
install(TARGETS ggml-base LIBRARY)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# FIXME: this should be done in the backend cmake files
|
# FIXME: this should be done in the backend cmake files
|
||||||
if (GGML_METAL)
|
if (GGML_METAL)
|
||||||
|
@ -239,8 +239,8 @@ function(ggml_add_backend backend)
|
|||||||
if (${BUILD_SHARED_LIBS})
|
if (${BUILD_SHARED_LIBS})
|
||||||
target_compile_definitions(${backend_target} PRIVATE GGML_BACKEND_BUILD)
|
target_compile_definitions(${backend_target} PRIVATE GGML_BACKEND_BUILD)
|
||||||
target_compile_definitions(${backend_target} PUBLIC GGML_BACKEND_SHARED)
|
target_compile_definitions(${backend_target} PUBLIC GGML_BACKEND_SHARED)
|
||||||
install(TARGETS ${backend_target} LIBRARY)
|
|
||||||
endif()
|
endif()
|
||||||
|
install(TARGETS ${backend_target} LIBRARY)
|
||||||
target_link_libraries(ggml PUBLIC ${backend_target})
|
target_link_libraries(ggml PUBLIC ${backend_target})
|
||||||
string(TOUPPER "GGML_USE_${backend}" backend_use)
|
string(TOUPPER "GGML_USE_${backend}" backend_use)
|
||||||
target_compile_definitions(ggml PUBLIC ${backend_use})
|
target_compile_definitions(ggml PUBLIC ${backend_use})
|
||||||
|
Loading…
Reference in New Issue
Block a user