Skip to content

Commit

Permalink
Add workaround for Bazel build on macOS
Browse files Browse the repository at this point in the history
This works around bazelbuild/bazel#3979,
and so closes google#282.
  • Loading branch information
drigz committed Jan 16, 2018
1 parent 028d378 commit 3106945
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions bazel/glog.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ def glog_library(namespace='google', with_gflags=1):
'-Wno-unused-function',
'-Wno-unused-local-typedefs',
'-Wno-unused-variable',
"-DGLOG_BAZEL_BUILD",
# Inject a C++ namespace.
"-D_START_GOOGLE_NAMESPACE_='namespace %s {'" % namespace,
"-D_END_GOOGLE_NAMESPACE_='}'",
"-DGOOGLE_NAMESPACE='%s'" % namespace,
# Allows src/base/mutex.h to include pthread.h.
'-DHAVE_PTHREAD',
Expand Down
12 changes: 12 additions & 0 deletions src/config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,20 @@
/* Version number of package */
#cmakedefine VERSION

#ifdef GLOG_BAZEL_BUILD

/* TODO(rodrigoq): remove this workaround once bazel#3979 is resolved:
* https://github.com/bazelbuild/bazel/issues/3979 */
#define _START_GOOGLE_NAMESPACE_ namespace GOOGLE_NAMESPACE {

#define _END_GOOGLE_NAMESPACE_ }

#else

/* Stops putting the code inside the Google namespace */
#cmakedefine _END_GOOGLE_NAMESPACE_ ${_END_GOOGLE_NAMESPACE_}

/* Puts following code inside the Google namespace */
#cmakedefine _START_GOOGLE_NAMESPACE_ ${_START_GOOGLE_NAMESPACE_}

#endif

0 comments on commit 3106945

Please sign in to comment.