Skip to content

Commit

Permalink
Update build script to include version parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Apr 1, 2024
1 parent 7c0f65d commit a8edb95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ jobs:
"CUDA_TOOLKIT_ROOT_DIR=$env:CUDA_PATH" >> $env:GITHUB_ENV
- name: "Run Build-Windows.ps1"
run: "./Build-Windows.ps1"
run: "./Build-Windows.ps1 -Version ${{ steps.get-version.outputs.version }}"
env:
CPU_OR_CUDA: ${{ matrix.cublas }}

- uses: "actions/upload-artifact@v4"
with:
Expand Down
11 changes: 6 additions & 5 deletions build-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Param(
[string]$Version
)

# check env var CPU_OR_CUDA
if ($env:CPU_OR_CUDA -eq $null) {
Expand All @@ -8,24 +11,22 @@ if ($env:CPU_OR_CUDA -eq $null) {
$cmakeArgs = @()
if ($env:CPU_OR_CUDA -eq "cpu") {
$cmakeArgs += ("-DWHISPERCPP_WITH_CUDA=OFF")
$zipFileName = "whispercpp-windows-cpu-$Version.zip"
} else {
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=ON",
"-DCUDA_TOOLKIT_ROOT_DIR=$env:CUDA_TOOLKIT_ROOT_DIR"
)
$zipFileName = "whispercpp-windows-cuda$env:CPU_OR_CUDA-$Version.zip"
}

Remove-Item -Path build/CMakeCache.txt -Force

# configure
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release @cmakeArgs

cmake --build build --config Release

Remove-Item -Path release -Recurse -Force

# install
cmake --install build

# compress the release folder
Compress-Archive -Path release -DestinationPath whispercpp-windows-$env:CPU_OR_CUDA.zip
Compress-Archive -Path release -DestinationPath $zipFileName

0 comments on commit a8edb95

Please sign in to comment.