Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
Autodetec win version to correct process CreateFile2
  • Loading branch information
magicse authored Jan 31, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent aa6fb13 commit 786b6a9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion examples/server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -4,9 +4,23 @@ option(LLAMA_SERVER_SSL "Build SSL support for the server" OFF)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})

macro(get_WIN32_WINNT version)
if (WIN32 AND CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
string(REPLACE "." "" ver ${ver})
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif()
endmacro()

get_WIN32_WINNT(ver)

if (MINGW)
# fix: https://github.com/ggerganov/llama.cpp/actions/runs/9651004652/job/26617901362?pr=8006
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
# add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
add_definitions(-D_WIN32_WINNT=${ver})
message(STATUS "MinGW detected, setting _WIN32_WINNT to ${ver}")
endif()

set(TARGET_SRCS

0 comments on commit 786b6a9

Please sign in to comment.