################################################################################ # Copyright 2016 Google LLC. # # This software is licensed under the terms defined in the Widevine Master # License Agreement. For a copy of this agreement, please contact # widevine-licensing@google.com. ################################################################################ # Bazel build file for glog. licenses(["notice"]) # Common options required by all library targets. glog_copts = [ "-Isrc", "-D_START_GOOGLE_NAMESPACE_='namespace google {'", "-D_END_GOOGLE_NAMESPACE_=}", "-DGOOGLE_NAMESPACE=google", "-DGOOGLE_GLOG_DLL_DECL=", "-DHAVE_LIB_GFLAGS", "-DHAVE_PTHREAD", "-DHAVE_RWLOCK", "-DHAVE_PREAD", "-DHAVE_PWRITE", "-DHAVE_SYS_TIME_H", "-DHAVE_SYS_UTSNAME_H", "-DHAVE_UNISTD_H", "-DHAVE_GLOB_H", "-DHAVE___ATTRIBUTE__", "-D__NR_gettid", "-Wno-sign-compare", ] cc_library( name = "glog", srcs = [ "src/base/commandlineflags.h", "src/base/googleinit.h", "src/base/mutex.h", "src/demangle.cc", "src/demangle.h", "src/glog/log_severity.h", "src/logging.cc", "src/raw_logging.cc", "src/signalhandler.cc", "src/stacktrace.h", "src/stacktrace_generic-inl.h", "src/stacktrace_libunwind-inl.h", "src/stacktrace_powerpc-inl.h", "src/stacktrace_x86-inl.h", "src/stacktrace_x86_64-inl.h", "src/symbolize.cc", "src/symbolize.h", "src/utilities.cc", "src/utilities.h", "src/vlog_is_on.cc", ":config_h", ":logging_h", ":raw_logging_h", ":stl_logging_h", ":vlog_is_on_h", ], hdrs = glob(["glog/*.h"]), copts = glog_copts, includes = ["src/"], linkopts = ["-pthread"], visibility = ["//visibility:public"], deps = ["//external:gflags"], ) genrule( name = "config_h", srcs = ["src/config.h.cmake.in"], outs = ["config.h"], cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)", ) sub_cmd = ("awk '{ " + "gsub(/@ac_google_start_namespace@/, \"namespace google {\"); " + "gsub(/@ac_google_end_namespace@/, \"} // namespace google\"); " + "gsub(/@ac_google_namespace@/, \"google\"); " + ("gsub(/@(ac_cv_have_stdint_h|ac_cv_have_uint16_t|" + "ac_cv_have_libgflags|ac_cv_have_unistd_h|" + "ac_cv_have___builtin_expect|" + "ac_cv_cxx_using_operator)@/, \"1\"); ") + "gsub(/@ac_cv___attribute___noreturn@/, \"__attribute__ ((noreturn))\"); " + "gsub(/@ac_cv___attribute___noinline@/, \"__attribute__ ((noinline))\"); " + "gsub(/@(ac_cv___attribute___[a-z0-9_]+)@/, \"\"); " + "gsub(/@([a-z0-9_]+)@/, \"0\"); " + "print; }' $(<) > $(@)") genrule( name = "logging_h", srcs = ["src/glog/logging.h.in"], outs = ["glog/logging.h"], cmd = sub_cmd, ) genrule( name = "raw_logging_h", srcs = ["src/glog/raw_logging.h.in"], outs = ["glog/raw_logging.h"], cmd = sub_cmd, ) genrule( name = "stl_logging_h", srcs = ["src/glog/stl_logging.h.in"], outs = ["glog/stl_logging.h"], cmd = sub_cmd, ) genrule( name = "vlog_is_on_h", srcs = ["src/glog/vlog_is_on.h.in"], outs = ["glog/vlog_is_on.h"], cmd = sub_cmd, ) cc_library( name = "test_hdrs", hdrs = [ "src/config_for_unittests.h", "src/googletest.h", ], ) cc_test( name = "demangle_unittest", size = "small", srcs = ["src/demangle_unittest.cc"], copts = glog_copts, data = ["src/demangle_unittest.txt"], deps = [ ":glog", ":test_hdrs", ], ) cc_test( name = "logging_unittest", size = "small", srcs = ["src/logging_unittest.cc"], copts = glog_copts, data = ["src/logging_unittest.err"], deps = [ ":glog", ":test_hdrs", ], ) cc_test( name = "stacktrace_unittest", size = "small", srcs = ["src/stacktrace_unittest.cc"], copts = glog_copts, deps = [ ":glog", ":test_hdrs", ], ) cc_test( name = "symbolize_unittest", size = "small", srcs = ["src/symbolize_unittest.cc"], copts = glog_copts, deps = [ ":glog", ":test_hdrs", ], ) cc_test( name = "utilities_unittest", size = "small", srcs = ["src/utilities_unittest.cc"], copts = glog_copts, deps = [ ":glog", ":test_hdrs", ], )