Syed Jafri commited on
Commit
ee0f706
·
unverified ·
1 Parent(s): 205cfee

Cross compilation (#121)

Browse files

* Cross compile windows

* set env properly

* rm log

* fix review

* Add back space

Files changed (2) hide show
  1. Makefile +11 -3
  2. ggml.c +2 -2
Makefile CHANGED
@@ -1,6 +1,14 @@
 
1
  UNAME_S := $(shell uname -s)
 
 
 
2
  UNAME_P := $(shell uname -p)
 
 
 
3
  UNAME_M := $(shell uname -m)
 
4
 
5
  # Mac OS + Arm can report x86_64
6
  # ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
@@ -78,13 +86,13 @@ main: examples/main/main.cpp ggml.o whisper.o
78
  ./main -h
79
 
80
  ggml.o: ggml.c ggml.h
81
- $(CC) $(CFLAGS) -c ggml.c
82
 
83
  whisper.o: whisper.cpp whisper.h
84
- $(CXX) $(CXXFLAGS) -c whisper.cpp
85
 
86
  libwhisper.a: ggml.o whisper.o
87
- ar rcs libwhisper.a ggml.o whisper.o
88
 
89
  clean:
90
  rm -f *.o main stream bench libwhisper.a
 
1
+ ifndef UNAME_S
2
  UNAME_S := $(shell uname -s)
3
+ endif
4
+
5
+ ifndef UNAME_P
6
  UNAME_P := $(shell uname -p)
7
+ endif
8
+
9
+ ifndef UNAME_M
10
  UNAME_M := $(shell uname -m)
11
+ endif
12
 
13
  # Mac OS + Arm can report x86_64
14
  # ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
 
86
  ./main -h
87
 
88
  ggml.o: ggml.c ggml.h
89
+ $(CC) $(CFLAGS) -c ggml.c -o ggml.o
90
 
91
  whisper.o: whisper.cpp whisper.h
92
+ $(CXX) $(CXXFLAGS) -c whisper.cpp -o whisper.o
93
 
94
  libwhisper.a: ggml.o whisper.o
95
+ $(AR) rcs libwhisper.a ggml.o whisper.o
96
 
97
  clean:
98
  rm -f *.o main stream bench libwhisper.a
ggml.c CHANGED
@@ -14,7 +14,7 @@
14
  #include <stdint.h>
15
  #include <stdio.h>
16
 
17
- #if defined _MSC_VER
18
  #include <Windows.h>
19
 
20
  typedef volatile LONG atomic_int;
@@ -198,7 +198,7 @@ static ggml_fp16_t table_exp_f16[1 << 16];
198
  // timing
199
  //
200
 
201
- #if defined(_MSC_VER)
202
  static int64_t timer_freq;
203
  void ggml_time_init(void) {
204
  LARGE_INTEGER frequency;
 
14
  #include <stdint.h>
15
  #include <stdio.h>
16
 
17
+ #if defined _MSC_VER || defined(__MINGW32__)
18
  #include <Windows.h>
19
 
20
  typedef volatile LONG atomic_int;
 
198
  // timing
199
  //
200
 
201
+ #if defined(_MSC_VER) || defined(__MINGW32__)
202
  static int64_t timer_freq;
203
  void ggml_time_init(void) {
204
  LARGE_INTEGER frequency;