Skip to content

Commit 206459a

Browse files
authored
bindings-go : update Makefile to use cmake (#2952)
This commit updates the Makefile to use cmake instead of make to build whisper.cpp. The motivation for this change is that currently the make recipe test will fail with the following error: ```console $ make test Mkdir build Mkdir models Build whisper make[1]: Entering directory '/home/danbev/work/ai/whisper-work' make[1]: *** No rule to make target 'libwhisper.a'. Stop. make[1]: Leaving directory '/home/danbev/work/ai/whisper-work' make: *** [Makefile:33: whisper] Error 2 ```
1 parent 21d890d commit 206459a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

bindings/go/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ UNAME_M := $(shell uname -m)
1111
endif
1212

1313
GGML_METAL_PATH_RESOURCES := $(abspath ../..)
14-
BUILD_DIR := build
14+
BUILD_DIR := build_go
1515
MODELS_DIR := models
1616
EXAMPLES_DIR := $(wildcard examples/*)
1717
INCLUDE_PATH := $(abspath ../../include):$(abspath ../../ggml/include)
18-
LIBRARY_PATH := $(abspath ../..)
18+
LIBRARY_PATH := $(abspath ../../${BUILD_DIR}/src:$(abspath ../../${BUILD_DIR}/ggml/src))
1919

2020
ifeq ($(GGML_CUDA),1)
2121
LIBRARY_PATH := $(LIBRARY_PATH):$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib/
@@ -29,8 +29,10 @@ endif
2929
all: clean whisper examples
3030

3131
whisper: mkdir
32-
@echo Build whisper
33-
@${MAKE} -C ../.. libwhisper.a
32+
cmake -S ../.. -B ../../${BUILD_DIR} \
33+
-DCMAKE_BUILD_TYPE=Release \
34+
-DBUILD_SHARED_LIBS=OFF
35+
cmake --build ../../${BUILD_DIR} --target whisper
3436

3537
test: model-small whisper modtidy
3638
ifeq ($(UNAME_S),Darwin)

bindings/go/whisper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// CGO
1010

1111
/*
12-
#cgo LDFLAGS: -lwhisper -lm -lstdc++ -fopenmp
12+
#cgo LDFLAGS: -lwhisper -lggml -lggml-base -lggml-cpu -lm -lstdc++ -fopenmp
1313
#cgo darwin LDFLAGS: -framework Accelerate -framework Metal -framework Foundation -framework CoreGraphics
1414
#include <whisper.h>
1515
#include <stdlib.h>

0 commit comments

Comments
 (0)