Skip to content

Commit 62ff351

Browse files
zaucyjbeder
authored andcommitted
Add bazel Support (jbeder#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"], )
1 parent 5e9cb01 commit 62ff351

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build/
22
/tags
3+
/bazel-*

BUILD.bazel

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cc_library(
2+
name = "yaml-cpp_internal",
3+
visibility = ["//:__subpackages__"],
4+
strip_include_prefix = "src",
5+
hdrs = glob(["src/**/*.h"]),
6+
)
7+
8+
cc_library(
9+
name = "yaml-cpp",
10+
visibility = ["//visibility:public"],
11+
strip_include_prefix = "include",
12+
hdrs = glob(["include/**/*.h"]),
13+
srcs = glob(["src/**/*.cpp", "src/**/*.h"]),
14+
)

WORKSPACE

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
workspace(name = "com_github_jbeder_yaml_cpp")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
name = "com_google_googletest",
7+
strip_prefix = "googletest-release-1.8.1",
8+
url = "https://github.com/google/googletest/archive/release-1.8.1.tar.gz",
9+
sha256 = "9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c",
10+
)

test/BUILD.bazel

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cc_test(
2+
name = "test",
3+
srcs = glob([
4+
"*.cpp",
5+
"*.h",
6+
"integrations/*.cpp",
7+
"node/*.cpp",
8+
]),
9+
deps = [
10+
"//:yaml-cpp",
11+
"//:yaml-cpp_internal",
12+
"@com_google_googletest//:gtest_main",
13+
],
14+
)

0 commit comments

Comments
 (0)