mirror of
https://github.com/ollama/ollama.git
synced 2026-04-17 15:53:27 +02:00
* prefer rocm v6 on windows Avoid building with v7 - more changes are needed * MLX: add header vendoring and remove go build tag This switches to using a vendoring approach for the mlx-c headers so that Go can build without requiring a cmake first. This enables building the new MLX based code by default. Every time cmake runs, the headers are refreshed, so we can easily keep them in sync when we bump mlx versions. Basic Windows and Linux support are verified. * ci: harden for flaky choco repo servers CI sometimes fails due to choco not actually installing cache. Since it just speeds up the build, we can proceed without. * review comments
31 lines
828 B
CMake
31 lines
828 B
CMake
cmake_minimum_required(VERSION 3.5)
|
|
|
|
project(mlx)
|
|
|
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/dist" CACHE PATH "" FORCE)
|
|
endif()
|
|
|
|
set(MLX_BUILD_GGUF OFF CACHE BOOL "" FORCE)
|
|
set(MLX_BUILD_SAFETENSORS ON CACHE BOOL "" FORCE)
|
|
set(MLX_C_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
|
|
|
|
set(CMAKE_INSTALL_RPATH "@loader_path")
|
|
|
|
include(FetchContent)
|
|
|
|
set(MLX_C_GIT_TAG "v0.5.0" CACHE STRING "")
|
|
|
|
FetchContent_Declare(
|
|
mlx-c
|
|
GIT_REPOSITORY "https://github.com/ml-explore/mlx-c.git"
|
|
GIT_TAG ${MLX_C_GIT_TAG}
|
|
)
|
|
|
|
FetchContent_MakeAvailable(mlx-c)
|
|
|
|
# Sync vendored headers with fetched version
|
|
file(GLOB _mlx_c_hdrs "${mlx-c_SOURCE_DIR}/mlx/c/*.h")
|
|
file(COPY ${_mlx_c_hdrs} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/include/mlx/c/")
|