docs: extend Windows cmake build options and add Pack and Run

This commit is contained in:
Trevor SANDY 2025-11-26 23:15:34 +01:00
parent eeffe2edc2
commit ddf51c1f7d
1 changed files with 30 additions and 9 deletions

View File

@ -86,7 +86,7 @@ cmake --build build --config Release
cmake --build build --config Release -j 4 cmake --build build --config Release -j 4
cd .. cd ..
``` ```
- To suppress warnings, add the following to `if (MSVC)...` in the top-level _CMakeLists.txt_. - To suppress warnings, add the following to `if (MSVC)`... in the top-level _CMakeLists.txt_.
```cmake ```cmake
add_compile_options( add_compile_options(
/wd4101 # unreferenced local variable /wd4101 # unreferenced local variable
@ -94,22 +94,43 @@ cmake --build build --config Release
/wd4267 # conversion from 'size_t' to a smaller type, possible loss of data /wd4267 # conversion from 'size_t' to a smaller type, possible loss of data
/wd4305 # truncation from 'type1' to 'type2' /wd4305 # truncation from 'type1' to 'type2'
/wd4319 # zero extending 'uint32_t' to 'size_t' of greater size /wd4319 # zero extending 'uint32_t' to 'size_t' of greater size
/wd4334 # result of 32-bit shift implicitly converted to 64 bits
/wd4804 # unsafe use of type 'bool' /wd4804 # unsafe use of type 'bool'
/wd4996 # the POSIX name for this item is deprecated /wd4996 # the POSIX name for this item is deprecated
) )
``` ```
- Build configuration - release build with build shared libs disabled. - Build configuration - windows-cpu release build with shared libs enabled.
```bat ```bat
:: Use full file paths for libcurl and ccache. Replace <user> with valid user ID if applicable. :: Use full file paths for libcurl and ccache.
cmake -B build -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release ^ SET CURL_PATH=%USERPROFILE%\Projects\llama.cpp\vcpkg\packages\curl_x64-windows
-DCURL_LIBRARY=C:\Users\<user>\Projects\llama.cpp\vcpkg\packages\curl_x64-windows\lib\libcurl.lib ^ SET CCACHE_PATH=%USERPROFILE%\Projects\llama.cpp\ccache\build\Release
-DCURL_INCLUDE_DIR=C:\Users\<user>\Projects\llama.cpp\vcpkg\packages\curl_x64-windows\include ^ cmake -S . -B build -G "Visual Studio 17 2022" ^
-DCMAKE_C_COMPILER_LAUNCHER=C:\Users\<user>\Projects\llama.cpp\ccache\build\Release\ccache.exe ^ -DBUILD_SHARED_LIBS=ON ^
-DCMAKE_CXX_COMPILER_LAUNCHER=C:\Users\<user>\Projects\llama.cpp\ccache\build\Release\ccache.exe -DCMAKE_BUILD_TYPE=Release ^
-DGGML_NATIVE=OFF ^
-DGGML_BACKEND_DL=ON ^
-DGGML_CPU_ALL_VARIANTS=ON ^
-DGGML_OPENMP=ON ^
-DCURL_LIBRARY=%CURL_PATH%\lib\libcurl.lib ^
-DCURL_INCLUDE_DIR=%CURL_PATH%\include ^
-DCMAKE_C_COMPILER_LAUNCHER=%CCACHE_PATH%\ccache.exe ^
-DCMAKE_CXX_COMPILER_LAUNCHER=%CCACHE_PATH%\ccache.exe
``` ```
- Build - Build
```bat ```bat
cmake --build build --config Release -j 8 cmake --build build --config Release
```
- Pack
```bat
copy %CURL_PATH%\bin\libcurl.dll build\bin\Release
:: Use qualified 7zip path if not in PATH - e.g. vcpkg\downloads\tools\7zip-25.01-windows\7z
<qualified path>\7z a llama-bin-win-cpu-x64.zip build\bin\Release\*
```
- Run WebUI
```bat
cd build\bin\Release
:: local HTTP server accessed via browser: http://localhost:8080
llama-server -hf ggml-org/gemma-3-1b-it-GGUF
``` ```
## BLAS Build ## BLAS Build