mirror of
https://github.com/ollama/ollama.git
synced 2026-04-18 09:03:35 -04:00
ci: harden cuda include path handling (#15093)
On windows we can get multiple include dirs, so find where the headers are then copy from that location.
This commit is contained in:
@@ -284,7 +284,19 @@ if(MLX_ENGINE)
|
|||||||
# The Go mlxrunner sets CUDA_PATH to OLLAMA_INSTALL_DIR so MLX finds them at
|
# The Go mlxrunner sets CUDA_PATH to OLLAMA_INSTALL_DIR so MLX finds them at
|
||||||
# $CUDA_PATH/include/*.h via NVRTC --include-path.
|
# $CUDA_PATH/include/*.h via NVRTC --include-path.
|
||||||
if(CUDAToolkit_FOUND)
|
if(CUDAToolkit_FOUND)
|
||||||
set(_cuda_inc "${CUDAToolkit_INCLUDE_DIRS}")
|
# CUDAToolkit_INCLUDE_DIRS may be a semicolon-separated list
|
||||||
|
# (e.g. ".../include;.../include/cccl"). Find the entry that
|
||||||
|
# contains the CUDA runtime headers we need.
|
||||||
|
set(_cuda_inc "")
|
||||||
|
foreach(_dir ${CUDAToolkit_INCLUDE_DIRS})
|
||||||
|
if(EXISTS "${_dir}/cuda_runtime_api.h")
|
||||||
|
set(_cuda_inc "${_dir}")
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(NOT _cuda_inc)
|
||||||
|
message(WARNING "Could not find cuda_runtime_api.h in CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}")
|
||||||
|
else()
|
||||||
set(_dst "${OLLAMA_INSTALL_DIR}/include")
|
set(_dst "${OLLAMA_INSTALL_DIR}/include")
|
||||||
set(_MLX_JIT_CUDA_HEADERS
|
set(_MLX_JIT_CUDA_HEADERS
|
||||||
builtin_types.h
|
builtin_types.h
|
||||||
@@ -320,6 +332,7 @@ if(MLX_ENGINE)
|
|||||||
DESTINATION "${_dst}/crt"
|
DESTINATION "${_dst}/crt"
|
||||||
COMPONENT MLX)
|
COMPONENT MLX)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# On Windows, explicitly install dl.dll (dlfcn-win32 POSIX dlopen emulation)
|
# On Windows, explicitly install dl.dll (dlfcn-win32 POSIX dlopen emulation)
|
||||||
# RUNTIME_DEPENDENCIES auto-excludes it via POST_EXCLUDE_FILES_STRICT because
|
# RUNTIME_DEPENDENCIES auto-excludes it via POST_EXCLUDE_FILES_STRICT because
|
||||||
|
|||||||
Reference in New Issue
Block a user