ggml-cpu: fix cross-compilation to Windows from Linux

Fix compilation error when cross-compiling ggml-cpu for Windows using MinGW-w64 on Linux. The _WIN32_WINNT macro is only defined by MSVC headers, causing undefined macro warnings with GCC/MinGW.

When cross-compiling llama.cpp for Windows from Linux using MinGW-w64, the `_WIN32_WINNT` macro is not defined (it's provided by MSVC SDK headers). This causes compilation warnings or errors. The fix adds `defined(_MSC_VER)` guard to ensure this Windows-specific code path is only evaluated when compiling with MSVC.
This commit is contained in:
Yeison Patiño 2026-03-19 09:05:50 -05:00 committed by GitHub
parent 4065c1a3a6
commit e6b05bbe5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -2491,7 +2491,7 @@ static bool ggml_thread_apply_priority(int32_t prio) {
// Newer Windows 11 versions aggressively park (offline) CPU cores and often place
// all our threads onto the first 4 cores which results in terrible performance with
// n_threads > 4
#if _WIN32_WINNT >= 0x0602
#if defined(_MSC_VER) && _WIN32_WINNT >= 0x0602
THREAD_POWER_THROTTLING_STATE t;
ZeroMemory(&t, sizeof(t));
t.Version = THREAD_POWER_THROTTLING_CURRENT_VERSION;