Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
reduce the size of the nlohmann json library download
Browse files Browse the repository at this point in the history
  • Loading branch information
tommadams committed Aug 15, 2019
1 parent 684d368 commit d5e9697
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 17 deletions.
16 changes: 8 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ 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",
strip_prefix = "tensorflow-1.13.1",
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()
10 changes: 9 additions & 1 deletion cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ minigo_cc_library(
deps = [
":base",
":gtp_client",
":json",
":logging",
":mcts",
":sgf",
Expand All @@ -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",
Expand All @@ -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 = [
Expand Down
7 changes: 0 additions & 7 deletions cc/json.BUILD

This file was deleted.

20 changes: 20 additions & 0 deletions cc/json.h
Original file line number Diff line number Diff line change
@@ -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_
2 changes: 1 addition & 1 deletion cc/minigui_gtp_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down

0 comments on commit d5e9697

Please sign in to comment.