mirror of
https://github.com/ollama/ollama.git
synced 2026-04-17 15:53:27 +02:00
ci: fix windows cgo compiler error (#15046)
This commit is contained in:
@@ -101,12 +101,25 @@ file(COPY ${_mlx_c_hdrs} DESTINATION "${CMAKE_SOURCE_DIR}/x/mlxrunner/mlx/includ
|
||||
# Regenerate Go/C shim wrappers from the (possibly updated) headers.
|
||||
find_program(GO_EXECUTABLE go REQUIRED)
|
||||
message(STATUS "Regenerating MLX Go wrappers")
|
||||
|
||||
# Go's cgo splits CC on whitespace, so a CC like "C:/Program Files/…/cl.exe"
|
||||
# (set by cmake on Windows) breaks with "C:/Program" not found. Clear CC
|
||||
# when it contains spaces so cgo falls back to its default (gcc).
|
||||
if(WIN32 AND "$ENV{CC}" MATCHES " ")
|
||||
set(_SAVE_CC "$ENV{CC}")
|
||||
set(ENV{CC} "")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GO_EXECUTABLE} generate ./x/...
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
|
||||
if(DEFINED _SAVE_CC)
|
||||
set(ENV{CC} "${_SAVE_CC}")
|
||||
endif()
|
||||
|
||||
# For local dev builds, override MLX_VERSION with git describe output
|
||||
if(TARGET mlx_version AND DEFINED FETCHCONTENT_SOURCE_DIR_MLX)
|
||||
execute_process(
|
||||
|
||||
Reference in New Issue
Block a user