Skip to content

Commit b99dd03

Browse files
cebtenzzreteleprint-me
authored andcommitted
build : target Windows 8 for standard mingw-w64 (ggml-org#4405)
* build : target Windows 8 for standard mingw-w64 * make : fix missing console.o deps This was causing a link error with `make all` on Windows.
1 parent 192a329 commit b99dd03

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,11 @@ else()
610610
message(STATUS "Unknown architecture")
611611
endif()
612612

613+
if (MINGW)
614+
# Target Windows 8 for PrefetchVirtualMemory
615+
add_compile_definitions(_WIN32_WINNT=0x602)
616+
endif()
617+
613618
#
614619
# POSIX conformance
615620
#

Makefile

+10-7
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,15 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
306306
#MK_CXXFLAGS += -mssse3
307307
endif
308308

309-
# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
310-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
311-
# https://github.com/ggerganov/llama.cpp/issues/2922
312309
ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
310+
# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
311+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
312+
# https://github.com/ggerganov/llama.cpp/issues/2922
313313
MK_CFLAGS += -Xassembler -muse-unaligned-vector-move
314314
MK_CXXFLAGS += -Xassembler -muse-unaligned-vector-move
315+
316+
# Target Windows 8 for PrefetchVirtualMemory
317+
MK_CPPFLAGS += -D_WIN32_WINNT=0x602
315318
endif
316319

317320
ifneq ($(filter aarch64%,$(UNAME_M)),)
@@ -745,16 +748,16 @@ tests/test-quantize-perf: tests/test-quantize-perf.cpp ggml.o $(OBJS)
745748
tests/test-sampling: tests/test-sampling.cpp ggml.o llama.o $(OBJS)
746749
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
747750

748-
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
751+
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
749752
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
750753

751-
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
754+
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
752755
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
753756

754-
tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
757+
tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
755758
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
756759

757-
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
760+
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
758761
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
759762

760763
tests/test-rope: tests/test-rope.cpp ggml.o $(OBJS)

0 commit comments

Comments
 (0)