Skip to content

Commit

Permalink
Use abseil-cpp VLOG (#354)
Browse files Browse the repository at this point in the history
Abseil-cpp LTS 20240116 now supports VLOG.

https://github.com/abseil/abseil-cpp/releases/tag/20240116.1

Use it instead of making VLOG a no-op.
  • Loading branch information
Deev Patel authored Mar 1, 2024
1 parent db21ca6 commit 7940c9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ find_package(OpenSSL REQUIRED)
# pthreads isn't used directly, but this is still required for std::thread.
find_package(Threads REQUIRED)

if (NOT TARGET absl::vlog_is_on)
message(FATAL_ERROR "Could not find absl vlog module. Are you using an older version?")
endif()

if (WITH_PYTHON)
# Should be easy to make it work with swig3, but some args to %pythonprepend
# seem to be different and were changed.
Expand Down Expand Up @@ -227,6 +231,7 @@ target_link_libraries(
absl::strings
absl::type_traits
absl::utility
absl::vlog_is_on
${CMAKE_THREAD_LIBS_INIT})

if (GOOGLETEST_ROOT)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ cd s2geometry

### Building

First, [install Abseil](https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md#traditional-cmake-set-up).
First, [install Abseil](https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md#traditional-cmake-set-up). We require [20240116.1](https://github.com/abseil/abseil-cpp/releases/tag/20240116.1) as the minimal version.
It must be configured with `-DCMAKE_POSITION_INDEPENDENT_CODE=ON`.
s2geometry must be configured to use the same C++ version that
abseil uses. The easiest way to achieve this is to pass
Expand Down
12 changes: 3 additions & 9 deletions src/s2/base/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// include the relevant absl file directly instead.
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/log/vlog_is_on.h"
#include "s2/base/log_severity.h"

// The names CHECK, etc. are too common and may conflict with other
Expand Down Expand Up @@ -48,14 +49,7 @@
#define S2_DCHECK_GT DCHECK_GT
#define S2_DCHECK_GE DCHECK_GE

// Logging stream that does nothing.
struct S2NullStream {
template <typename T>
S2NullStream& operator<<(const T& v) { return *this; }
};

// Abseil-cpp doesn't support VLOG yet. Make VLOG a no-op.
#define S2_VLOG(verbose_level) S2NullStream()
#define S2_VLOG_IS_ON(verbose_level) (false)
#define S2_VLOG VLOG
#define S2_VLOG_IS_ON VLOG_IS_ON

#endif // S2_BASE_LOGGING_H_

0 comments on commit 7940c9f

Please sign in to comment.