From e9136ee17e57d628d365d165b37636345c88242d Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Fri, 26 Jul 2019 19:02:02 -0400 Subject: [PATCH] Update README.md --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 8d2bb3c99..a5a3278a0 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,34 @@ endif() `thirdparty/nlohmann_json` is then a complete copy of this source tree. +### Bazel + +In order to use this project in Bazel, the simplest approach is to download the +single header release in your `bzl` or `BUILD` file: + +``` +http_file( + name = "com_github_nlohmann_json_single_header", + urls = [ + "https://github.com/nlohmann/json/releases/download/v3.4.0/json.hpp", + ], + sha256 = "63da6d1f22b2a7bb9e4ff7d6b255cf691a161ff49532dcc45d398a53e295835f", +) +``` + +Then include it as a dependency: + +``` +cc_library( + name = "foo", + srcs = foo_srcs, + hdrs = foo_hdrs, + deps = [ + "@com_github_nlohmann_json_single_header//file" + ], +) +``` + ### Package Managers :beer: If you are using OS X and [Homebrew](http://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann-json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann-json --HEAD`.