Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(glog): build config and API changes in v0.7.0 #827

Merged
merged 4 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,19 @@ if(ENABLE_LOGGING)
find_package(Glog REQUIRED)
if(Glog_FOUND)
include_directories(${Glog_INCLUDE_PATH})
endif()
if(Glog_STATIC)
add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
if(WIN32)
add_compile_definitions("GLOG_DEPRECATED=__declspec(deprecated)")
add_compile_definitions(GLOG_NO_ABBREVIATED_SEVERITIES)
else()
add_compile_definitions("GLOG_DEPRECATED=__attribute__((deprecated))")
endif()
if(Glog_STATIC)
add_compile_definitions(GLOG_EXPORT=)
add_compile_definitions(GLOG_NO_EXPORT=)
else()
add_compile_definitions("GLOG_EXPORT=__attribute__((visibility(\"default\")))")
add_compile_definitions("GLOG_NO_EXPORT=__attribute__((visibility(\"default\")))")
endif()
endif()

set(RIME_ENABLE_LOGGING 1)
Expand Down
2 changes: 1 addition & 1 deletion deps/glog
Submodule glog updated 92 files
+6 −2 .bazelci/presubmit.yml
+3 −3 .clang-format
+1 −1 .clang-tidy
+10 −0 .github/dependabot.yml
+31 −13 .github/workflows/android.yml
+26 −0 .github/workflows/cifuzz.yml
+57 −0 .github/workflows/emscripten.yml
+22 −30 .github/workflows/linux.yml
+22 −29 .github/workflows/macos.yml
+47 −36 .github/workflows/windows.yml
+1 −0 AUTHORS
+485 −512 CMakeLists.txt
+2 −0 CONTRIBUTORS
+1 −38 COPYING
+5 −0 ChangeLog
+6 −0 MODULE.bazel
+319 −187 README.rst
+7 −0 WORKSPACE
+125 −117 bazel/glog.bzl
+1 −1 cmake/GetCacheVariables.cmake
+12 −8 cmake/RunCleanerTest1.cmake
+12 −8 cmake/RunCleanerTest2.cmake
+12 −8 cmake/RunCleanerTest3.cmake
+4 −14 cmake/TestPackageConfig.cmake
+11 −0 codecov.yml
+8 −0 gcovr.cfg
+2 −0 glog-config.cmake.in
+55 −53 src/base/commandlineflags.h
+10 −12 src/base/googleinit.h
+0 −333 src/base/mutex.h
+14 −14 src/cleanup_immediately_unittest.cc
+14 −14 src/cleanup_with_absolute_prefix_unittest.cc
+14 −14 src/cleanup_with_relative_prefix_unittest.cc
+39 −128 src/config.h.cmake.in
+7 −0 src/dcheck_unittest/CMakeLists.txt
+53 −0 src/dcheck_unittest/glog_dcheck.cc
+342 −343 src/demangle.cc
+17 −8 src/demangle.h
+26 −28 src/demangle_unittest.cc
+7 −0 src/demangle_unittest.txt
+158 −0 src/flags.cc
+32 −0 src/fuzz_demangle.cc
+191 −0 src/glog/flags.h
+42 −14 src/glog/log_severity.h
+1,744 −0 src/glog/logging.h
+0 −2,002 src/glog/logging.h.in
+15 −11 src/glog/platform.h
+75 −78 src/glog/raw_logging.h
+44 −96 src/glog/stl_logging.h
+81 −0 src/glog/types.h
+38 −20 src/glog/vlog_is_on.h
+220 −274 src/googletest.h
+16 −0 src/includes_unittest/CMakeLists.txt
+39 −0 src/includes_unittest/glog_includes_logging.cc
+39 −0 src/includes_unittest/glog_includes_raw_logging.cc
+4 −5 src/includes_unittest/glog_includes_stl_logging.cc
+4 −5 src/includes_unittest/glog_includes_vlog_is_on.cc
+10 −0 src/log_severity_unittest/CMakeLists.txt
+40 −0 src/log_severity_unittest/glog_log_severity_constants.cc
+42 −0 src/log_severity_unittest/glog_log_severity_conversion.cc
+1,132 −988 src/logging.cc
+0 −1,384 src/logging_custom_prefix_unittest.cc
+0 −308 src/logging_custom_prefix_unittest.err
+11 −10 src/logging_striplog_test.sh
+477 −366 src/logging_unittest.cc
+17 −19 src/mock-log.h
+11 −16 src/mock-log_unittest.cc
+2 −5 src/package_config_unittest/working_config/glog_package_config.cc
+85 −53 src/raw_logging.cc
+106 −113 src/signalhandler.cc
+33 −37 src/signalhandler_unittest.cc
+38 −0 src/stacktrace.cc
+45 −9 src/stacktrace.h
+8 −4 src/stacktrace_generic-inl.h
+9 −7 src/stacktrace_libunwind-inl.h
+28 −22 src/stacktrace_powerpc-inl.h
+73 −61 src/stacktrace_unittest.cc
+20 −20 src/stacktrace_unwind-inl.h
+9 −6 src/stacktrace_windows-inl.h
+44 −31 src/stacktrace_x86-inl.h
+8 −101 src/stl_logging_unittest.cc
+23 −9 src/striplog_unittest.cc
+283 −270 src/symbolize.cc
+102 −55 src/symbolize.h
+159 −121 src/symbolize_unittest.cc
+138 −211 src/utilities.cc
+175 −109 src/utilities.h
+6 −12 src/utilities_unittest.cc
+46 −61 src/vlog_is_on.cc
+625 −744 src/windows/dirent.h
+17 −26 src/windows/port.cc
+63 −102 src/windows/port.h
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ set(rime_gears_deps
${Opencc_LIBRARY})
set(rime_levers_deps "")

if(Glog_FOUND AND WIN32)
# TODO: in glog v0.7.0, someone at Google forget to add dbghelp.lib to the linker library list.
set(rime_core_deps ${rime_core_deps} dbghelp)
endif()

if(MINGW)
# fix: bcrypt for boost uuid issue
# https://github.com/boostorg/uuid/issues/68
Expand Down
1 change: 0 additions & 1 deletion src/rime/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <boost/signals2/signal.hpp>

#ifdef RIME_ENABLE_LOGGING
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
#else
#include "no_logging.h"
Expand Down
15 changes: 8 additions & 7 deletions src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,15 @@ bool CleanOldLogFiles::Run(Deployer* deployer) {
string today(ymd);
DLOG(INFO) << "today: " << today;

// Make sure we have sufficient permissions on the scanned directories.
// E.g. on Android, there's no write permission on the cwd.
vector<string> dirs;
// Don't call GetLoggingDirectories as it contains current directory,
// which causes permission issue on Android
// https://github.com/google/glog/blob/b58718f37cf58fa17f48bf1d576974d133d89839/src/logging.cc#L2410
if (FLAGS_log_dir.empty()) {
google::GetExistingTempDirectories(&dirs);
} else {
dirs.push_back(FLAGS_log_dir);
for (auto& dir : google::GetLoggingDirectories()) {
auto perms = fs::status(dir).permissions();
if ((perms & (fs::perms::owner_write | fs::perms::group_write |
fs::perms::others_write)) != fs::perms::none) {
dirs.push_back(dir);
}
}
DLOG(INFO) << "scanning " << dirs.size() << " temp directory for log files.";

Expand Down
5 changes: 2 additions & 3 deletions src/rime/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
#include <rime/build_config.h>

#ifdef RIME_ENABLE_LOGGING
#ifdef _WIN32
#define GLOG_NO_ABBREVIATED_SEVERITIES
#endif // _WIN32
#include <glog/logging.h>
#else
#include "no_logging.h"
#endif // RIME_ENABLE_LOGGING

#include <rime_api.h>
Expand Down
Loading