diff --git a/WORKSPACE b/WORKSPACE index 62234a3d7..689493b1f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,6 +12,14 @@ http_archive( ], ) +# This should also be kept up to date with the version used by Tensorflow. +http_file( + name = "com_github_nlohmann_json_single_header", + urls = [ + "https://github.com/nlohmann/json/releases/download/v3.4.0/json.hpp", + ], +) + http_archive( name = "org_tensorflow", sha256 = "902a6d90bb69549fe241377210aa459773459820da1333b67dcfdef37836f25f", @@ -19,14 +27,6 @@ http_archive( urls = ["https://github.com/tensorflow/tensorflow/archive/v1.13.1.zip"], ) -http_archive( - name = "com_github_nlohmann_json", - build_file = "//cc:json.BUILD", - sha256 = "2ef2fe6f1a615ad97beb39f91ef5e319d776f6ba0af91570003276e6ffb1c47c", - strip_prefix = "json-3.2.0", - urls = ["https://github.com/nlohmann/json/archive/v3.2.0.zip"], -) - load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace") tf_workspace() diff --git a/cc/BUILD b/cc/BUILD index 658971fb6..ae0dc329e 100644 --- a/cc/BUILD +++ b/cc/BUILD @@ -129,6 +129,7 @@ minigo_cc_library( deps = [ ":base", ":gtp_client", + ":json", ":logging", ":mcts", ":sgf", @@ -137,7 +138,6 @@ minigo_cc_library( "//cc/dual_net", "//cc/dual_net:batching_dual_net", "//cc/file", - "@com_github_nlohmann_json//:json", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", @@ -146,6 +146,14 @@ minigo_cc_library( ], ) +cc_library( + name = "json", + hdrs = [ + "json.h", + "@com_github_nlohmann_json_single_header//file", + ], +) + minigo_cc_library( name = "mcts", srcs = [ diff --git a/cc/json.BUILD b/cc/json.BUILD deleted file mode 100644 index 77a5c4827..000000000 --- a/cc/json.BUILD +++ /dev/null @@ -1,7 +0,0 @@ -cc_library( - name = "json", - hdrs = ["single_include/nlohmann/json.hpp"], - includes = ["single_include"], - visibility = ["//visibility:public"], -) - diff --git a/cc/json.h b/cc/json.h new file mode 100644 index 000000000..55e6756ca --- /dev/null +++ b/cc/json.h @@ -0,0 +1,20 @@ +// Copyright 2019 Google LLC +// +// 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 MINIGO_CC_JSON_H_ +#define MINIGO_CC_JSON_H_ + +#include "external/com_github_nlohmann_json_single_header/file/json.hpp" + +#endif // MINIGO_CC_JSON_H_ diff --git a/cc/minigui_gtp_client.cc b/cc/minigui_gtp_client.cc index 01f616906..cf7c205d4 100644 --- a/cc/minigui_gtp_client.cc +++ b/cc/minigui_gtp_client.cc @@ -27,9 +27,9 @@ #include "absl/time/clock.h" #include "cc/constants.h" #include "cc/file/utils.h" +#include "cc/json.h" #include "cc/logging.h" #include "cc/sgf.h" -#include "nlohmann/json.hpp" namespace minigo {