Skip to content

Commit 3b3471e

Browse files
committed
Add build targets option
1 parent dd8368c commit 3b3471e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

rebuild_llama.cpp.ps1

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Specifies the BLAS accelerator, supported values are: "OpenBLAS", "CUDA", "OFF"
1313
.PARAMETER version
1414
Specifies a llama.cpp commit or tag to checkout a specific version.
1515
16+
.PARAMETER target
17+
Specifies CMake build targets to compile a specific subset of the llama.cpp project.
18+
1619
.EXAMPLE
1720
.\rebuild_llama.cpp.ps1
1821
@@ -21,6 +24,9 @@ Specifies a llama.cpp commit or tag to checkout a specific version.
2124
2225
.EXAMPLE
2326
.\rebuild_llama.cpp.ps1 -blasAccelerator "CUDA" -version "master-4e7464e"
27+
28+
.EXAMPLE
29+
.\rebuild_llama.cpp.ps1 -target "llama-server llama-cli"
2430
#>
2531

2632
Param (
@@ -29,7 +35,10 @@ Param (
2935
$blasAccelerator,
3036

3137
[String]
32-
$version
38+
$version,
39+
40+
[String]
41+
$target="default"
3342
)
3443

3544
$stopwatch = [System.Diagnostics.Stopwatch]::startNew()
@@ -66,9 +75,10 @@ if (!$blasAccelerator) {
6675
}
6776
}
6877

69-
Write-Host "Building llama.cpp..." -ForegroundColor "Yellow"
78+
Write-Host "Building the llama.cpp project..." -ForegroundColor "Yellow"
7079
Write-Host "Version: ${version}" -ForegroundColor "DarkYellow"
7180
Write-Host "BLAS accelerator: ${blasAccelerator}" -ForegroundColor "DarkYellow"
81+
Write-Host "Target: ${target}" -ForegroundColor "DarkYellow"
7282

7383
$openBLASVersion = "0.3.26"
7484

@@ -140,6 +150,8 @@ New-Item -Path "./vendor/llama.cpp" -Name "build" -ItemType "directory"
140150

141151
Set-Location -Path "./vendor/llama.cpp/build"
142152

153+
Write-Host "[CMake] Configuring and generating project..." -ForegroundColor "Yellow"
154+
143155
switch ($blasAccelerator) {
144156

145157
"OpenBLAS" {
@@ -161,10 +173,13 @@ switch ($blasAccelerator) {
161173
}
162174
}
163175

176+
Write-Host "[CMake] Building project targets '${target}'..." -ForegroundColor "Yellow"
177+
164178
cmake `
165179
--build . `
166180
--config Release `
167-
--parallel (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
181+
--parallel (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors `
182+
--target "${target}"
168183

169184
Copy-Item -Path "../../OpenBLAS/bin/libopenblas.dll" -Destination "./bin/Release/libopenblas.dll"
170185

0 commit comments

Comments
 (0)