Install required runtime dlls to package directory on windows

This commit is contained in:
Andrei Betlen 2023-09-16 14:57:49 -04:00
parent acf18fcdf0
commit 8d75016549
3 changed files with 12 additions and 3 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4...3.22)
cmake_minimum_required(VERSION 3.21)
project(llama_cpp)
@ -33,4 +33,13 @@ if (LLAMA_BUILD)
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
)
# Workaround for Windows + CUDA https://github.com/abetlen/llama-cpp-python/issues/563
install(
FILES $<TARGET_RUNTIME_DLLS:llama>
DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
)
install(
FILES $<TARGET_RUNTIME_DLLS:llama>
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
)
endif()

View file

@ -58,7 +58,7 @@ def _load_shared_library(lib_base_name: str):
if "CUDA_PATH" in os.environ:
os.add_dll_directory(os.path.join(os.environ["CUDA_PATH"], "bin"))
os.add_dll_directory(os.path.join(os.environ["CUDA_PATH"], "lib"))
cdll_args["winmode"] = 0
cdll_args["winmode"] = ctypes.RTLD_GLOBAL
# Try to load the shared library, handling potential errors
for _lib_path in _lib_paths:

View file

@ -54,7 +54,7 @@ all = [
[tool.scikit-build]
wheel.packages = ["llama_cpp"]
cmake.verbose = true
cmake.minimum-version = "3.12"
cmake.minimum-version = "3.21"
minimum-version = "0.5"
sdist.exclude = [".git", "vendor/llama.cpp/.git"]