Skip to content

Commit 6138963

Browse files
authored
build : target Windows 8 for standard mingw-w64 (#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 6391817 commit 6138963

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
@@ -593,6 +593,11 @@ else()
593593
message(STATUS "Unknown architecture")
594594
endif()
595595

596+
if (MINGW)
597+
# Target Windows 8 for PrefetchVirtualMemory
598+
add_compile_definitions(_WIN32_WINNT=0x602)
599+
endif()
600+
596601
#
597602
# POSIX conformance
598603
#

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)),)
@@ -730,16 +733,16 @@ tests/test-quantize-perf: tests/test-quantize-perf.cpp ggml.o $(OBJS)
730733
tests/test-sampling: tests/test-sampling.cpp ggml.o llama.o $(OBJS)
731734
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
732735

733-
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
736+
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
734737
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
735738

736-
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
739+
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
737740
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
738741

739-
tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
742+
tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
740743
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
741744

742-
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
745+
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) console.o $(OBJS)
743746
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
744747

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

0 commit comments

Comments
 (0)