Skip to content

Commit ef75a89

Browse files
authored
build : move _WIN32_WINNT definition to headers (#17736)
Previously, cmake was forcing `_WIN32_WINNT=0x0A00` for MinGW builds, This caused "macro redefined" warnings with toolchains that define the version. This also removes the `GGML_WIN_VER` variable as it is no longer needed. Signed-off-by: Adrien Gallouët <[email protected]>
1 parent d8b5cdc commit ef75a89

File tree

6 files changed

+8
-19
lines changed

6 files changed

+8
-19
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ if (NOT TARGET ggml AND NOT LLAMA_USE_SYSTEM_GGML)
199199
# ... otherwise assume ggml is added by a parent CMakeLists.txt
200200
endif()
201201

202-
if (MINGW)
203-
# Target Windows 8 for PrefetchVirtualMemory
204-
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
205-
endif()
206-
207202
#
208203
# build the library
209204
#

common/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
#include <vector>
1313
#include <map>
1414

15+
#if defined(_WIN32) && !defined(_WIN32_WINNT)
16+
#define _WIN32_WINNT 0x0A00
17+
#endif
18+
1519
#ifdef _WIN32
1620
#define DIRECTORY_SEPARATOR '\\'
1721
#else

ggml/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ option(GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requi
175175
set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
176176
set(GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC")
177177

178-
179-
if (MINGW)
180-
set(GGML_WIN_VER "0xA00" CACHE STRING "ggml: Windows version")
181-
endif()
182-
183178
# ggml core
184179
set(GGML_SCHED_MAX_COPIES "4" CACHE STRING "ggml: max input copies for pipeline parallelism")
185180
option(GGML_CPU "ggml: enable CPU backend" ON)

ggml/include/ggml.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@
204204
# define GGML_ATTRIBUTE_FORMAT(...) __attribute__((format(printf, __VA_ARGS__)))
205205
#endif
206206

207+
#if defined(_WIN32) && !defined(_WIN32_WINNT)
208+
# define _WIN32_WINNT 0x0A00
209+
#endif
210+
207211
#include <stdbool.h>
208212
#include <stddef.h>
209213
#include <stdint.h>

ggml/src/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ if (NOT MSVC)
127127
endif()
128128
endif()
129129

130-
if (MINGW)
131-
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
132-
endif()
133-
134130
#
135131
# POSIX conformance
136132
#

tools/server/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ set(TARGET llama-server)
22

33
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
44

5-
if (MINGW)
6-
# fix: https://github.com/ggml-org/llama.cpp/actions/runs/9651004652/job/26617901362?pr=8006
7-
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
8-
endif()
9-
105
if (NOT LLAMA_HTTPLIB)
116
message(FATAL_ERROR "LLAMA_HTTPLIB is OFF, cannot build llama-server. Hint: to skip building server, set -DLLAMA_BUILD_SERVER=OFF")
127
endif()

0 commit comments

Comments
 (0)