Add bazel Support (#724)

Example of how someone might consume yaml-cpp with bazel:

cc_binary(
    name = "example",
    srcs = ["example.cc"],
    deps = ["@com_github_jbeder_yaml_cpp//:yaml-cpp"],
)
This commit is contained in:
Ezekiel Warren 2019-09-27 08:11:38 -07:00 committed by Jesse Beder
parent 5e9cb0128d
commit 62ff351432
4 changed files with 39 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
build/
/tags
/bazel-*

14
BUILD.bazel Normal file
View File

@ -0,0 +1,14 @@
cc_library(
name = "yaml-cpp_internal",
visibility = ["//:__subpackages__"],
strip_include_prefix = "src",
hdrs = glob(["src/**/*.h"]),
)
cc_library(
name = "yaml-cpp",
visibility = ["//visibility:public"],
strip_include_prefix = "include",
hdrs = glob(["include/**/*.h"]),
srcs = glob(["src/**/*.cpp", "src/**/*.h"]),
)

10
WORKSPACE Normal file
View File

@ -0,0 +1,10 @@
workspace(name = "com_github_jbeder_yaml_cpp")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_google_googletest",
strip_prefix = "googletest-release-1.8.1",
url = "https://github.com/google/googletest/archive/release-1.8.1.tar.gz",
sha256 = "9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c",
)

14
test/BUILD.bazel Normal file
View File

@ -0,0 +1,14 @@
cc_test(
name = "test",
srcs = glob([
"*.cpp",
"*.h",
"integrations/*.cpp",
"node/*.cpp",
]),
deps = [
"//:yaml-cpp",
"//:yaml-cpp_internal",
"@com_google_googletest//:gtest_main",
],
)