Browse Source

remove need for `$VSINSTALLDIR` since build will fail if `ninja` cannot be found (#3350)

Jeffrey Morgan 1 year ago
parent
commit
856b8ec131
2 changed files with 10 additions and 15 deletions
  1. 9 8
      docs/development.md
  2. 1 7
      llm/generate/gen_windows.ps1

+ 9 - 8
docs/development.md

@@ -116,29 +116,30 @@ Note: The windows build for Ollama is still under development.
 
 Install required tools:
 
-- MSVC toolchain - C/C++ and cmake as minimal requirements - You must build from a "Developer Shell" with the environment variables set
-- go version 1.22 or higher
+- MSVC toolchain - C/C++ and cmake as minimal requirements
+- Go version 1.22 or higher
 - MinGW (pick one variant) with GCC.
-  - <https://www.mingw-w64.org/>
-  - <https://www.msys2.org/>
+  - [MinGW-w64](https://www.mingw-w64.org/)
+  - [MSYS2](https://www.msys2.org/)
 
 ```powershell
 $env:CGO_ENABLED="1"
-
 go generate ./...
-
 go build .
 ```
 
 #### Windows CUDA (NVIDIA)
 
-In addition to the common Windows development tools described above, install CUDA **AFTER** you install MSVC.
+In addition to the common Windows development tools described above, install CUDA after installing MSVC.
 
 - [NVIDIA CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html)
 
 
 #### Windows ROCm (AMD Radeon)
 
-In addition to the common Windows development tools described above, install AMDs HIP package **AFTER** you install MSVC
+In addition to the common Windows development tools described above, install AMDs HIP package after installing MSVC.
 
 - [AMD HIP](https://www.amd.com/en/developer/resources/rocm-hub/hip-sdk.html)
+- [Strawberry Perl](https://strawberryperl.com/)
+
+Lastly, add `ninja.exe` included with MSVC to the system path (e.g. `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja`).

+ 1 - 7
llm/generate/gen_windows.ps1

@@ -27,12 +27,6 @@ function amdGPUs {
 }
 
 function init_vars {
-    # Verify the environment is a Developer Shell for MSVC 2019
-    write-host $env:VSINSTALLDIR
-    if (($env:VSINSTALLDIR -eq $null)) {
-        Write-Error "`r`nBUILD ERROR - YOUR DEVELOPMENT ENVIRONMENT IS NOT SET UP CORRECTLY`r`nTo build Ollama you must run from an MSVC Developer Shell`r`nSee .\docs\development.md for instructions to set up your dev environment"
-        exit 1
-    }
     $script:SRC_DIR = $(resolve-path "..\..\")
     $script:llamacppDir = "../llama.cpp"
     $script:cmakeDefs = @(
@@ -261,7 +255,7 @@ if ($null -ne $env:HIP_PATH) {
         )
 
     # Make sure the ROCm binary dir is first in the path
-    $env:PATH="$env:HIP_PATH\bin;$env:VSINSTALLDIR\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;$env:PATH"
+    $env:PATH="$env:HIP_PATH\bin;$env:PATH"
 
     # We have to clobber the LIB var from the developer shell for clang to work properly
     $env:LIB=""