python3Packages.mlx: use nlohmann_json from nixpkgs
This commit is contained in:
@@ -52,8 +52,9 @@ buildPythonPackage (finalAttrs: {
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Use system nanobind instead of fetching its sources
|
||||
# Use nix packages instead of fetching their sources
|
||||
./dont-fetch-nanobind.patch
|
||||
./dont-fetch-json.patch
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
(replaceVars ./darwin-build-fixes.patch {
|
||||
@@ -88,7 +89,7 @@ buildPythonPackage (finalAttrs: {
|
||||
(lib.cmakeBool "MLX_BUILD_METAL" false)
|
||||
(lib.cmakeBool "USE_SYSTEM_FMT" true)
|
||||
(lib.cmakeOptionType "filepath" "FETCHCONTENT_SOURCE_DIR_GGUFLIB" "${gguf-tools}")
|
||||
(lib.cmakeOptionType "filepath" "FETCHCONTENT_SOURCE_DIR_JSON" "${nlohmann_json.src}")
|
||||
(lib.cmakeFeature "CMAKE_CXX_FLAGS" "-I${lib.getDev nlohmann_json}/include/nlohmann")
|
||||
|
||||
# Cmake cannot find nanobind-config.cmake by itself
|
||||
(lib.cmakeFeature "nanobind_DIR" "${nanobind}/${python.sitePackages}/nanobind/cmake")
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2451aa65..f88d4889 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -241,14 +241,6 @@ else()
|
||||
set(MLX_BUILD_ACCELERATE OFF)
|
||||
endif()
|
||||
|
||||
-message(STATUS "Downloading json")
|
||||
-FetchContent_Declare(
|
||||
- json
|
||||
- URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
|
||||
-FetchContent_MakeAvailable(json)
|
||||
-target_include_directories(
|
||||
- mlx PRIVATE $<BUILD_INTERFACE:${json_SOURCE_DIR}/single_include/nlohmann>)
|
||||
-
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/mlx)
|
||||
|
||||
target_include_directories(
|
||||
|
||||
Reference in New Issue
Block a user