Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
Fine grain control over windows generate steps
Daniel Hiltgene4859c4563c3
diff --git a/llm/generate/gen_windows.ps1 b/llm/generate/gen_windows.ps1index 7639f4c92..4a1f22a33 100644--- a/llm/generate/gen_windows.ps1+++ b/llm/generate/gen_windows.ps1@@ -44,6 +44,7 @@ function init_vars {$script:commonCpuDefs = @("-DCMAKE_POSITION_INDEPENDENT_CODE=on")$script:ARCH = "amd64" # arm not yet supported.$script:DIST_BASE = "${script:SRC_DIR}\dist\windows-${script:ARCH}\ollama_runners"+ md "$script:DIST_BASE" -ea 0 > $nullif ($env:CGO_CFLAGS -contains "-g") {$script:cmakeDefs += @("-DCMAKE_VERBOSE_MAKEFILE=on", "-DLLAMA_SERVER_VERBOSE=on", "-DCMAKE_BUILD_TYPE=RelWithDebInfo")$script:config = "RelWithDebInfo"@@ -181,7 +182,7 @@ function cleanup {function build_static() {- if ($null -eq ${env:OLLAMA_SKIP_CPU_GENERATE}) {+ if ((-not "${env:OLLAMA_SKIP_STATIC_GENERATE}") -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "static"))) {# GCC build for direct linking into the Go binaryinit_vars# cmake will silently fallback to msvc compilers if mingw isn't in the path, so detect and fail fast@@ -213,7 +214,7 @@ function build_static() {}function build_cpu() {- if ($null -eq ${env:OLLAMA_SKIP_CPU_GENERATE}) {+ if ((-not "${env:OLLAMA_SKIP_CPU_GENERATE}" ) -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "cpu"))) {# remaining llama.cpp builds use MSVCinit_vars$script:cmakeDefs = $script:commonCpuDefs + @("-A", "x64", "-DLLAMA_AVX=off", "-DLLAMA_AVX2=off", "-DLLAMA_AVX512=off", "-DLLAMA_FMA=off", "-DLLAMA_F16C=off") + $script:cmakeDefs@@ -229,7 +230,7 @@ function build_cpu() {}function build_cpu_avx() {- if ($null -eq ${env:OLLAMA_SKIP_CPU_GENERATE}) {+ if ((-not "${env:OLLAMA_SKIP_CPU_GENERATE}" ) -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "cpu_avx"))) {init_vars$script:cmakeDefs = $script:commonCpuDefs + @("-A", "x64", "-DLLAMA_AVX=on", "-DLLAMA_AVX2=off", "-DLLAMA_AVX512=off", "-DLLAMA_FMA=off", "-DLLAMA_F16C=off") + $script:cmakeDefs$script:buildDir="../build/windows/${script:ARCH}/cpu_avx"@@ -239,12 +240,12 @@ function build_cpu_avx() {signinstall} else {- write-host "Skipping CPU generation step as requested"+ write-host "Skipping CPU AVX generation step as requested"}}function build_cpu_avx2() {- if ($null -eq ${env:OLLAMA_SKIP_CPU_GENERATE}) {+ if ((-not "${env:OLLAMA_SKIP_CPU_GENERATE}" ) -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "cpu_avx2"))) {init_vars$script:cmakeDefs = $script:commonCpuDefs + @("-A", "x64", "-DLLAMA_AVX=on", "-DLLAMA_AVX2=on", "-DLLAMA_AVX512=off", "-DLLAMA_FMA=on", "-DLLAMA_F16C=on") + $script:cmakeDefs$script:buildDir="../build/windows/${script:ARCH}/cpu_avx2"@@ -254,12 +255,12 @@ function build_cpu_avx2() {signinstall} else {- write-host "Skipping CPU generation step as requested"+ write-host "Skipping CPU AVX2 generation step as requested"}}function build_cuda() {- if ($null -ne $script:CUDA_LIB_DIR) {+ if ((-not "${env:OLLAMA_SKIP_CUDA_GENERATE}") -and ("${script:CUDA_LIB_DIR}")) {# Then build cuda as a dynamically loaded library$nvcc = "$script:CUDA_LIB_DIR\nvcc.exe"$script:CUDA_VERSION=(get-item ($nvcc | split-path | split-path)).Basename@@ -283,11 +284,13 @@ function build_cuda() {cp "${script:CUDA_LIB_DIR}\cudart64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\"cp "${script:CUDA_LIB_DIR}\cublas64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\"cp "${script:CUDA_LIB_DIR}\cublasLt64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\"+ } else {+ write-host "Skipping CUDA generation step"}}function build_rocm() {- if ($null -ne $env:HIP_PATH) {+ if ((-not "${env:OLLAMA_SKIP_ROCM_GENERATE}") -and ("${env:HIP_PATH}")) {$script:ROCM_VERSION=(get-item $env:HIP_PATH).Basenameif ($null -ne $script:ROCM_VERSION) {$script:ROCM_VARIANT="_v"+$script:ROCM_VERSION@@ -336,6 +339,8 @@ function build_rocm() {cp "${env:HIP_PATH}\bin\rocblas.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\"# amdhip64.dll dependency comes from the driver and must be installed on the host to use AMD GPUscp "${env:HIP_PATH}\bin\rocblas\library\*" "${script:SRC_DIR}\dist\windows-${script:ARCH}\rocm\rocblas\library\"+ } else {+ write-host "Skipping ROCm generation step"}}