mirror of
https://github.com/ollama/ollama.git
synced 2025-05-10 18:06:33 +02:00
* add build to .dockerignore * test: only build one arch * add build to .gitignore * fix ccache path * filter amdgpu targets * only filter if autodetecting * Don't clobber gpu list for default runner This ensures the GPU specific environment variables are set properly * explicitly set CXX compiler for HIP * Update build_windows.ps1 This isn't complete, but is close. Dependencies are missing, and it only builds the "default" preset. * build: add ollama subdir * add .git to .dockerignore * docs: update development.md * update build_darwin.sh * remove unused scripts * llm: add cwd and build/lib/ollama to library paths * default DYLD_LIBRARY_PATH to LD_LIBRARY_PATH in runner on macOS * add additional cmake output vars for msvc * interim edits to make server detection logic work with dll directories like lib/ollama/cuda_v12 * remove unncessary filepath.Dir, cleanup * add hardware-specific directory to path * use absolute server path * build: linux arm * cmake install targets * remove unused files * ml: visit each library path once * build: skip cpu variants on arm * build: install cpu targets * build: fix workflow * shorter names * fix rocblas install * docs: clean up development.md * consistent build dir removal in development.md * silence -Wimplicit-function-declaration build warnings in ggml-cpu * update readme * update development readme * llm: update library lookup logic now that there is one runner (#8587) * tweak development.md * update docs * add windows cuda/rocm tests --------- Co-authored-by: jmorganca <jmorganca@gmail.com> Co-authored-by: Daniel Hiltgen <daniel@ollama.com>
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package discover
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
)
|
|
|
|
// LibPath is a path to lookup dynamic libraries
|
|
// in development it's usually 'build/lib/ollama'
|
|
// in distribution builds it's 'lib/ollama' on Windows
|
|
// '../lib/ollama' on Linux and the executable's directory on macOS
|
|
// note: distribution builds, additional GPU-specific libraries are
|
|
// found in subdirectories of the returned path, such as
|
|
// 'cuda_v11', 'cuda_v12', 'rocm', etc.
|
|
var LibOllamaPath string = func() string {
|
|
exe, err := os.Executable()
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
|
|
exe, err = filepath.EvalSymlinks(exe)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
|
|
libPath := filepath.Dir(exe)
|
|
switch runtime.GOOS {
|
|
case "windows":
|
|
libPath = filepath.Join(filepath.Dir(exe), "lib", "ollama")
|
|
case "linux":
|
|
libPath = filepath.Join(filepath.Dir(exe), "..", "lib", "ollama")
|
|
}
|
|
|
|
cwd, err := os.Getwd()
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
|
|
// build paths for development
|
|
buildPaths := []string{
|
|
filepath.Join(filepath.Dir(exe), "build", "lib", "ollama"),
|
|
filepath.Join(cwd, "build", "lib", "ollama"),
|
|
}
|
|
|
|
for _, p := range buildPaths {
|
|
if _, err := os.Stat(p); err == nil {
|
|
return p
|
|
}
|
|
}
|
|
|
|
return libPath
|
|
}()
|