Skip to content

Commit

Permalink
Compile boost files, add example for static linking for compress sample
Browse files Browse the repository at this point in the history
  • Loading branch information
teodor-pripoae committed Dec 28, 2016
1 parent ef6463f commit 23f4698
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ cc_library(
"@snappy//:snappy",
"@zlib//:zlib",
"@gtest//:gtest",
"@boost//:boost"
],
copts = [
"-Iexternal/googletest/include",
"-Iexternal/boost/boost"
],
visibility = ["//visibility:public"],
)
Expand Down
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ new_http_archive(
url = "https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2/download",
type = "tar.bz2",
strip_prefix = "boost_1_61_0/",
build_file = "bazel/boost.BUILD",
sha256 = "a547bd06c2fd9a71ba1d169d9cf0339da7ebf4753849a8f7d6fdb8feee99b640",
)

Expand Down
12 changes: 12 additions & 0 deletions bazel/boost.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cc_library(
name = "boost",
srcs = [],
hdrs = glob([
"boost/**/*.h",
"boost/**/*.hpp",
"boost/**/*.ipp",
"boost/**/*.cc",
]),
includes = ["."],
visibility = ["//visibility:public"]
)
16 changes: 16 additions & 0 deletions sample/compress_sample/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
load("@protobuf//:protobuf.bzl", "cc_proto_library")

config_setting(
name = "darwin",
values = {
"cpu": "darwin",
},
visibility = ["//visibility:public"],
)

cc_proto_library(
name = "echo_proto",
srcs = [
Expand All @@ -23,6 +31,10 @@ cc_binary(
"@protobuf//:protobuf",
"@protobuf//:protoc_lib",
],
linkopts = select({
":darwin": [],
"//conditions:default": ["-static"]
}),
visibility = ["//main:__pkg__"],
)

Expand All @@ -36,5 +48,9 @@ cc_binary(
"@protobuf//:protobuf",
"@protobuf//:protoc_lib",
],
linkopts = select({
":darwin": [],
"//conditions:default": ["-static"]
}),
visibility = ["//main:__pkg__"],
)

0 comments on commit 23f4698

Please sign in to comment.