Add a bazel build.
This commit is contained in:
parent
65e4b973bd
commit
fc3cd7aa7f
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,3 +23,5 @@ cmake-build-debug
|
|||||||
|
|
||||||
test/test-*
|
test/test-*
|
||||||
/.vs
|
/.vs
|
||||||
|
|
||||||
|
bazel-*
|
||||||
|
|||||||
13
.travis.yml
13
.travis.yml
@ -39,6 +39,19 @@ matrix:
|
|||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['g++-4.9', 'valgrind', 'ninja-build']
|
packages: ['g++-4.9', 'valgrind', 'ninja-build']
|
||||||
|
|
||||||
|
# Bazel
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get install -y pkg-config zip g++ zlib1g-dev unzip python3 wget
|
||||||
|
- wget -q https://github.com/bazelbuild/bazel/releases/download/0.28.1/bazel-0.28.1-installer-linux-x86_64.sh
|
||||||
|
- chmod +x bazel-0.28.1-installer-linux-x86_64.sh
|
||||||
|
- ./bazel-0.28.1-installer-linux-x86_64.sh --user
|
||||||
|
script: $HOME/bin/bazel build --test_output=errors --verbose_failures=true --keep_going -- //...:all
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
update: true
|
||||||
|
|
||||||
# clang sanitizer
|
# clang sanitizer
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
|||||||
14
BUILD
Normal file
14
BUILD
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
exports_files([
|
||||||
|
"LICENSE.MIT"
|
||||||
|
])
|
||||||
|
|
||||||
|
load(":nlohmann_json.bzl", "nlohmann_json_hdrs", "nlohmann_json_srcs")
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "nlohmann_json",
|
||||||
|
srcs = nlohmann_json_srcs,
|
||||||
|
hdrs = nlohmann_json_hdrs,
|
||||||
|
deps = [],
|
||||||
|
)
|
||||||
28
README.md
28
README.md
@ -148,6 +148,34 @@ endif()
|
|||||||
|
|
||||||
`thirdparty/nlohmann_json` is then a complete copy of this source tree.
|
`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
|
### 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`.
|
: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`.
|
||||||
|
|||||||
39
nlohmann_json.bzl
Normal file
39
nlohmann_json.bzl
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
nlohmann_json_hdrs = [
|
||||||
|
"nlohmann/adl_serializer.hpp",
|
||||||
|
"nlohmann/json_fwd.hpp",
|
||||||
|
"nlohmann/thirdparty/hedley/hedley_undef.hpp",
|
||||||
|
"nlohmann/thirdparty/hedley/hedley.hpp",
|
||||||
|
"nlohmann/json.hpp",
|
||||||
|
"nlohmann/detail/json_pointer.hpp",
|
||||||
|
"nlohmann/detail/value_t.hpp",
|
||||||
|
"nlohmann/detail/input/json_sax.hpp",
|
||||||
|
"nlohmann/detail/input/lexer.hpp",
|
||||||
|
"nlohmann/detail/input/input_adapters.hpp",
|
||||||
|
"nlohmann/detail/input/position_t.hpp",
|
||||||
|
"nlohmann/detail/input/binary_reader.hpp",
|
||||||
|
"nlohmann/detail/input/parser.hpp",
|
||||||
|
"nlohmann/detail/iterators/internal_iterator.hpp",
|
||||||
|
"nlohmann/detail/iterators/iteration_proxy.hpp",
|
||||||
|
"nlohmann/detail/iterators/json_reverse_iterator.hpp",
|
||||||
|
"nlohmann/detail/iterators/iterator_traits.hpp",
|
||||||
|
"nlohmann/detail/iterators/iter_impl.hpp",
|
||||||
|
"nlohmann/detail/iterators/primitive_iterator.hpp",
|
||||||
|
"nlohmann/detail/json_ref.hpp",
|
||||||
|
"nlohmann/detail/macro_scope.hpp",
|
||||||
|
"nlohmann/detail/macro_unscope.hpp",
|
||||||
|
"nlohmann/detail/exceptions.hpp",
|
||||||
|
"nlohmann/detail/output/output_adapters.hpp",
|
||||||
|
"nlohmann/detail/output/serializer.hpp",
|
||||||
|
"nlohmann/detail/output/binary_writer.hpp",
|
||||||
|
"nlohmann/detail/conversions/from_json.hpp",
|
||||||
|
"nlohmann/detail/conversions/to_chars.hpp",
|
||||||
|
"nlohmann/detail/conversions/to_json.hpp",
|
||||||
|
"nlohmann/detail/meta/void_t.hpp",
|
||||||
|
"nlohmann/detail/meta/cpp_future.hpp",
|
||||||
|
"nlohmann/detail/meta/detected.hpp",
|
||||||
|
"nlohmann/detail/meta/is_sax.hpp",
|
||||||
|
"nlohmann/detail/meta/type_traits.hpp",
|
||||||
|
]
|
||||||
|
|
||||||
|
nlohmann_json_srcs = [
|
||||||
|
]
|
||||||
Loading…
Reference in New Issue
Block a user