From: Syed Jafri Date: Wed, 2 Nov 2022 06:46:49 +0000 (-0600) Subject: Cross compilation (#121) X-Git-Tag: upstream/1.7.4~1860 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=24cd12f647cf3a43f7c65d25671cb15541f9a35f;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp Cross compilation (#121) * Cross compile windows * set env properly * rm log * fix review * Add back space --- diff --git a/Makefile b/Makefile index 1b9d4b63..ff00a323 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ +ifndef UNAME_S UNAME_S := $(shell uname -s) +endif + +ifndef UNAME_P UNAME_P := $(shell uname -p) +endif + +ifndef UNAME_M UNAME_M := $(shell uname -m) +endif # Mac OS + Arm can report x86_64 # ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789 @@ -78,13 +86,13 @@ main: examples/main/main.cpp ggml.o whisper.o ./main -h ggml.o: ggml.c ggml.h - $(CC) $(CFLAGS) -c ggml.c + $(CC) $(CFLAGS) -c ggml.c -o ggml.o whisper.o: whisper.cpp whisper.h - $(CXX) $(CXXFLAGS) -c whisper.cpp + $(CXX) $(CXXFLAGS) -c whisper.cpp -o whisper.o libwhisper.a: ggml.o whisper.o - ar rcs libwhisper.a ggml.o whisper.o + $(AR) rcs libwhisper.a ggml.o whisper.o clean: rm -f *.o main stream bench libwhisper.a diff --git a/ggml.c b/ggml.c index 1000a5b6..79f1c308 100644 --- a/ggml.c +++ b/ggml.c @@ -14,7 +14,7 @@ #include #include -#if defined _MSC_VER +#if defined _MSC_VER || defined(__MINGW32__) #include typedef volatile LONG atomic_int; @@ -198,7 +198,7 @@ static ggml_fp16_t table_exp_f16[1 << 16]; // timing // -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) static int64_t timer_freq; void ggml_time_init(void) { LARGE_INTEGER frequency;