Skip to content

Commit 9dbf058

Browse files
fix: Try alternative windows build method
1 parent 4115788 commit 9dbf058

File tree

6 files changed

+57
-76
lines changed

6 files changed

+57
-76
lines changed

.github/workflows/all-platform-build.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/linux-cuda-build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ jobs:
3030
apt-get update
3131
apt-get install -y cmake build-essential
3232
33+
- name: Install CUDA Toolkit
34+
id: cuda-toolkit
35+
uses: Jimver/cuda-toolkit@v0.2.11
36+
with:
37+
cuda: '12.5.0'
38+
method: 'network'
39+
3340
- name: Build Linux CUDA Libraries
3441
run: make linux_cuda
3542

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Whisper.cpp
1+
name: Windows Cuda Build
22
on:
33
workflow_dispatch:
44
inputs:
@@ -9,35 +9,6 @@ on:
99
workflow_call:
1010

1111
jobs:
12-
# build-windows:
13-
# name: Build for Windows (x86_64)
14-
# runs-on: windows-latest
15-
# steps:
16-
# - name: Checkout repository
17-
# uses: actions/checkout@v4
18-
#
19-
# - name: Checkout whisper.cpp
20-
# uses: actions/checkout@v4
21-
# with:
22-
# repository: ggerganov/whisper.cpp
23-
# ref: ${{ github.event.inputs.version }}
24-
# path: whisper.cpp
25-
#
26-
# - name: Add msbuild to PATH
27-
# uses: microsoft/setup-msbuild@v1
28-
#
29-
# - name: Run build script
30-
# run: |
31-
# .\scripts\build.bat cpu ${{ github.workspace }}\whisper.cpp\
32-
# cd ${{ github.workspace }}\whisper.cpp\build\bin\Release
33-
# ren whisper.dll libwhisper.dll
34-
#
35-
# - name: Upload Windows Build Artifacts
36-
# uses: actions/upload-artifact@v4
37-
# with:
38-
# name: windows-build
39-
# path: whisper.cpp/build/bin/Release/libwhisper.dll
40-
4112
build-windows-cuda:
4213
name: Build for Windows (x86_64, CUDA)
4314
runs-on: windows-latest
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Windows Native Build
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Whisper.cpp tag, branch or commit to build'
7+
default: v1.7.2
8+
9+
workflow_call:
10+
11+
jobs:
12+
build-windows:
13+
name: Build for Windows (x86_64)
14+
runs-on: windows-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Checkout whisper.cpp
20+
uses: actions/checkout@v4
21+
with:
22+
repository: ggerganov/whisper.cpp
23+
ref: ${{ github.event.inputs.version }}
24+
path: whisper.cpp
25+
26+
- name: Add msbuild to PATH
27+
uses: microsoft/setup-msbuild@v1
28+
29+
# - name: Run build script
30+
# run: |
31+
# .\scripts\build.bat cpu ${{ github.workspace }}\whisper.cpp\
32+
# cd ${{ github.workspace }}\whisper.cpp\build\bin\Release
33+
# ren whisper.dll libwhisper.dll
34+
- name: Build Windows Native Libraries
35+
run: make windows
36+
37+
- name: Upload Windows Build Artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: windows-build
41+
# path: whisper.cpp/build/bin/Release/libwhisper.dll
42+
path: runtimes/windows-*/*

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ define windows_build
5151
$(eval ARCH := $(1))
5252
$(eval BUILD_PATH := $(BUILD_DIR)/windows-$(ARCH)$(2))
5353
$(eval EXTRA_FLAGS := $(3))
54-
rm -rf $(BUILD_PATH)
55-
$(CMAKE) -S $(WHISPER_CPP_DIR) -B $(BUILD_PATH) -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) $(CMAKE_COMMON_PARAMS) $(EXTRA_FLAGS)
56-
cd $(BUILD_PATH)
57-
msbuild ALL_BUILD.vcxproj -t:build -p:configuration=Release -p:platform=$(ARCH)
54+
if exist "$(BUILD_PATH)" rmdir /s /q "$(BUILD_PATH)"
55+
$(CMAKE) -S $(WHISPER_CPP_DIR) -B $(BUILD_PATH) -A $(ARCH) $(CMAKE_COMMON_PARAMS) $(EXTRA_FLAGS)
56+
cd "$(BUILD_PATH)" && msbuild ALL_BUILD.vcxproj -t:build -p:configuration=Release -p:platform=x64
57+
if not exist "$(RUNTIME_DIR)\windows-$(TARGET)" mkdir "$(RUNTIME_DIR)\windows-$(TARGET)"
58+
copy "$(BUILD_PATH)\src\Release\whisper.dll" "$(RUNTIME_DIR)\windows-$(TARGET)\"
59+
copy "$(BUILD_PATH)\ggml\src\Release\ggml.dll" "$(RUNTIME_DIR)\windows-$(TARGET)\"
5860
endef
5961

6062
# Linux build targets
@@ -102,7 +104,7 @@ windows_%:
102104
windows_cuda: $(addprefix windows_cuda_,$(WINDOWS_ARCHS))
103105
windows_cuda_%:
104106
$(eval ARCH := $(subst windows_cuda_,,$@))
105-
$(call windows_build,$(ARCH),_cuda,$(AVX_FLAGS) -DGGML_CUDA=ON -DWHISPER_CUBLAS=ON)
107+
$(call windows_build,$(ARCH),_cuda,$(AVX_FLAGS) -DGGML_CUDA=ON)
106108

107109
# Clean build artifacts
108110
.PHONY: clean

scripts/build.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ goto commonexit
1313
:cpu
1414
echo Starting building cpu target...
1515
cd %whisper_path%
16-
echo %whisper_path%
1716
rmdir .\build /s /q
1817
cmake -S . -B ./build -A x64 -DCMAKE_BUILD_TYPE=Release -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_EXAMPLES=OFF
1918

0 commit comments

Comments
 (0)