diff --git a/WORKSPACE b/WORKSPACE index 4ca01d4a4b..086efd07c7 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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. diff --git a/bazel/glog.BUILD b/bazel/glog.BUILD new file mode 100644 index 0000000000..7070fe1cc5 --- /dev/null +++ b/bazel/glog.BUILD @@ -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) " + , +) diff --git a/ortools/base/BUILD b/ortools/base/BUILD index 37950d2a16..00ede780a4 100644 --- a/ortools/base/BUILD +++ b/ortools/base/BUILD @@ -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", ], )