fetch json

This commit is contained in:
Awni Hannun 2023-12-19 14:49:50 -08:00 committed by dc-dc-dc
parent c043d27682
commit 3f82fe8888
2 changed files with 13 additions and 4 deletions

View File

@ -99,8 +99,17 @@ elseif (MLX_BUILD_METAL)
endif()
MESSAGE(STATUS "Downloading json")
find_package(nlohmann_json 3.11.3 REQUIRED)
target_link_libraries(mlx nlohmann_json::nlohmann_json)
FetchContent_Declare(
json
GIT_REPOSITORY "https://github.com/nlohmann/json"
GIT_TAG "v3.11.3"
)
FetchContent_MakeAvailable(json)
target_include_directories(
mlx PUBLIC
$<BUILD_INTERFACE:${json_SOURCE_DIR}/single_include/nlohmann>
$<INSTALL_INTERFACE:include/json>
)
find_library(ACCELERATE_LIBRARY Accelerate)
if (MLX_BUILD_ARM AND ACCELERATE_LIBRARY)

View File

@ -2,7 +2,7 @@
#pragma once
#include <nlohmann/json.hpp>
#include <json.hpp>
#include "mlx/load.h"
#include "mlx/ops.h"
@ -25,4 +25,4 @@ namespace mlx::core {
#define ST_U16 "U16"
#define ST_U32 "U32"
#define ST_U64 "U64"
} // namespace mlx::core
} // namespace mlx::core