-
Notifications
You must be signed in to change notification settings - Fork 291
/
Copy pathglog.patch
65 lines (61 loc) · 2.63 KB
/
glog.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 147504673e409fc5267f0422a58f170f442b5455 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <uwe.korn@quantco.com>
Date: Mon, 26 Feb 2024 09:21:31 +0100
Subject: [PATCH] GH-40181: [C++] Support glog 0.7 build
---
cpp/cmake_modules/FindGLOG.cmake | 8 +++++++-
cpp/src/arrow/util/logging.cc | 6 +++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/cpp/cmake_modules/FindGLOG.cmake b/cpp/cmake_modules/FindGLOG.cmake
index 61b7d0694efd4..62b235ee917ca 100644
--- a/cpp/cmake_modules/FindGLOG.cmake
+++ b/cpp/cmake_modules/FindGLOG.cmake
@@ -17,6 +17,11 @@
#
# find_package(GLOG)
+find_package(glog CONFIG)
+if(glog_FOUND)
+ return()
+endif()
+
if(GLOG_FOUND)
return()
endif()
@@ -56,5 +61,6 @@ if(GLOG_FOUND)
add_library(glog::glog UNKNOWN IMPORTED)
set_target_properties(glog::glog
PROPERTIES IMPORTED_LOCATION "${GLOG_LIB}"
- INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}")
+ INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT")
endif()
diff --git a/cpp/src/arrow/util/logging.cc b/cpp/src/arrow/util/logging.cc
index d2931132372a7..25c336a6d2111 100644
--- a/cpp/src/arrow/util/logging.cc
+++ b/cpp/src/arrow/util/logging.cc
@@ -116,7 +116,7 @@ static std::unique_ptr<std::string> log_dir_;
#ifdef ARROW_USE_GLOG
// Glog's severity map.
-static int GetMappedSeverity(ArrowLogLevel severity) {
+static google::LogSeverity GetMappedSeverity(ArrowLogLevel severity) {
switch (severity) {
case ArrowLogLevel::ARROW_DEBUG:
return google::GLOG_INFO;
@@ -148,7 +148,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
app_name_.reset(new std::string(app_name));
log_dir_.reset(new std::string(log_dir));
#ifdef ARROW_USE_GLOG
- int mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
+ google::LogSeverity mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
google::SetStderrLogging(mapped_severity_threshold);
// Enable log file if log_dir is not empty.
if (!log_dir.empty()) {
@@ -173,7 +173,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
google::SetLogFilenameExtension(app_name_without_path.c_str());
for (int i = static_cast<int>(severity_threshold_);
i <= static_cast<int>(ArrowLogLevel::ARROW_FATAL); ++i) {
- int level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
+ google::LogSeverity level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
google::SetLogDestination(level, dir_ends_with_slash.c_str());
}
}