From bacb1c81b0d05a2ecd05756c0655c43b420ded5d Mon Sep 17 00:00:00 2001 From: yanghaoran Date: Tue, 23 Aug 2022 14:41:55 +0800 Subject: [PATCH] update JSON for Modern C++ to 3.10.1 --- cmake/external_libs/json.cmake | 21 +++--- .../dataset/include/dataset/datasets.h | 2 +- .../dataset/include/dataset/json_fwd.hpp | 70 ------------------- 3 files changed, 12 insertions(+), 81 deletions(-) delete mode 100644 mindspore/ccsrc/minddata/dataset/include/dataset/json_fwd.hpp diff --git a/cmake/external_libs/json.cmake b/cmake/external_libs/json.cmake index efb21b193b3..10b73b6a40e 100644 --- a/cmake/external_libs/json.cmake +++ b/cmake/external_libs/json.cmake @@ -3,24 +3,25 @@ if(MSVC) set(flatbuffers_CFLAGS "${CMAKE_CXX_FLAGS}") set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") else() - set(nlohmann_json373_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2") - set(nlohmann_json373_CFLAGS "-D_FORTIFY_SOURCE=2 -O2") + set(nlohmann_json3101_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2") + set(nlohmann_json3101_CFLAGS "-D_FORTIFY_SOURCE=2 -O2") endif() if(ENABLE_GITEE) - set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.7.3.zip") - set(MD5 "b758acca4f3e133bacf919e31ca302e3") + set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.10.1.zip") + set(MD5 "a402ee7412bd6c7fcb994946ff977c44") set(INCLUDE "./include") else() - set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip") - set(MD5 "fb96f95cdf609143e998db401ca4f324") + + set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.10.1/include.zip") + set(MD5 "990b11a4fd9e1b05be02959a439fd402") set(INCLUDE "./include") endif() -mindspore_add_pkg(nlohmann_json373 - VER 3.7.3 +mindspore_add_pkg(nlohmann_json3101 + VER 3.10.1 HEAD_ONLY ${INCLUDE} URL ${REQ_URL} MD5 ${MD5}) -include_directories(${nlohmann_json373_INC}) -add_library(mindspore::json ALIAS nlohmann_json373) +include_directories(${nlohmann_json3101_INC}) +add_library(mindspore::json ALIAS nlohmann_json3101) diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h b/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h index ffd1ce19014..b3c9c2daa73 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h @@ -34,7 +34,7 @@ #include "include/api/dual_abi_helper.h" #include "include/api/types.h" #include "include/dataset/iterator.h" -#include "include/dataset/json_fwd.hpp" +#include "nlohmann/json_fwd.hpp" #include "include/dataset/samplers.h" #include "include/dataset/text.h" diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/json_fwd.hpp b/mindspore/ccsrc/minddata/dataset/include/dataset/json_fwd.hpp deleted file mode 100644 index 10d9875a793..00000000000 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/json_fwd.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ -#define INCLUDE_NLOHMANN_JSON_FWD_HPP_ - -#include - -/*! -@brief namespace for Niels Lohmann -@see https://github.com/nlohmann -@since version 1.0.0 -*/ -namespace nlohmann { -/*! -@brief default JSONSerializer template argument - -This serializer ignores the template arguments and uses ADL -([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) -for serialization. -*/ -template -struct adl_serializer; - -template