USe glog for logging with bazel.
This commit is contained in:
@@ -5,6 +5,14 @@ git_repository(
|
||||
remote = "https://github.com/gflags/gflags.git",
|
||||
)
|
||||
|
||||
#Import the glog files.
|
||||
new_git_repository(
|
||||
name = "com_github_glog_glog",
|
||||
build_file = "//bazel:glog.BUILD",
|
||||
remote = "https://github.com/google/glog.git",
|
||||
tag = "v0.3.5",
|
||||
)
|
||||
|
||||
# proto_library rules implicitly depend on @com_google_protobuf//:protoc,
|
||||
# which is the proto-compiler.
|
||||
# This statement defines the @com_google_protobuf repo.
|
||||
|
||||
82
bazel/glog.BUILD
Normal file
82
bazel/glog.BUILD
Normal file
@@ -0,0 +1,82 @@
|
||||
cc_library(
|
||||
name = "glog",
|
||||
srcs = [
|
||||
"config.h",
|
||||
"src/base/commandlineflags.h",
|
||||
"src/base/googleinit.h",
|
||||
"src/base/mutex.h",
|
||||
"src/demangle.cc",
|
||||
"src/demangle.h",
|
||||
"src/logging.cc",
|
||||
"src/raw_logging.cc",
|
||||
"src/signalhandler.cc",
|
||||
"src/symbolize.cc",
|
||||
"src/symbolize.h",
|
||||
"src/utilities.cc",
|
||||
"src/utilities.h",
|
||||
"src/vlog_is_on.cc",
|
||||
] + glob(["src/stacktrace*.h"]),
|
||||
hdrs = [
|
||||
"src/glog/log_severity.h",
|
||||
"src/glog/logging.h",
|
||||
"src/glog/raw_logging.h",
|
||||
"src/glog/stl_logging.h",
|
||||
"src/glog/vlog_is_on.h",
|
||||
],
|
||||
copts = [
|
||||
"-Wno-sign-compare",
|
||||
"-U_XOPEN_SOURCE",
|
||||
],
|
||||
includes = ["./src"],
|
||||
linkopts = ["-lpthread"] + select({
|
||||
":libunwind": ["-lunwind"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@com_github_gflags_gflags//:gflags",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "libunwind",
|
||||
values = {
|
||||
"define": "libunwind=true",
|
||||
},
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "run_configure",
|
||||
srcs = [
|
||||
"README",
|
||||
"Makefile.in",
|
||||
"config.guess",
|
||||
"config.sub",
|
||||
"install-sh",
|
||||
"ltmain.sh",
|
||||
"missing",
|
||||
"libglog.pc.in",
|
||||
"src/config.h.in",
|
||||
"src/glog/logging.h.in",
|
||||
"src/glog/raw_logging.h.in",
|
||||
"src/glog/stl_logging.h.in",
|
||||
"src/glog/vlog_is_on.h.in",
|
||||
],
|
||||
outs = [
|
||||
"config.h",
|
||||
"src/glog/logging.h",
|
||||
"src/glog/raw_logging.h",
|
||||
"src/glog/stl_logging.h",
|
||||
"src/glog/vlog_is_on.h",
|
||||
],
|
||||
tools = [
|
||||
"configure",
|
||||
],
|
||||
cmd = "$(location :configure)" +
|
||||
"&& cp -v src/config.h $(location config.h) " +
|
||||
"&& cp -v src/glog/logging.h $(location src/glog/logging.h) " +
|
||||
"&& cp -v src/glog/raw_logging.h $(location src/glog/raw_logging.h) " +
|
||||
"&& cp -v src/glog/stl_logging.h $(location src/glog/stl_logging.h) " +
|
||||
"&& cp -v src/glog/vlog_is_on.h $(location src/glog/vlog_is_on.h) "
|
||||
,
|
||||
)
|
||||
@@ -2,9 +2,6 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_library(
|
||||
name = "base",
|
||||
srcs = [
|
||||
"logging.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"basictypes.h",
|
||||
"casts.h",
|
||||
@@ -18,6 +15,7 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
"@com_github_gflags_gflags//:gflags",
|
||||
"@com_github_glog_glog//:glog",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user