From e3593954ac9d572c29cb957c5192549b147810c0 Mon Sep 17 00:00:00 2001 From: sarlinpe Date: Tue, 26 Nov 2024 09:41:23 +0100 Subject: [PATCH] Detect glog init for <=0.5 --- _pyceres/logging.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_pyceres/logging.h b/_pyceres/logging.h index 3b8d53a..5dd92fa 100644 --- a/_pyceres/logging.h +++ b/_pyceres/logging.h @@ -219,9 +219,13 @@ void BindLogging(py::module& m) { .value("ERROR", Logging::LogSeverity::GLOG_ERROR) .value("FATAL", Logging::LogSeverity::GLOG_FATAL) .export_values(); + #if defined(GLOG_VERSION_MAJOR) && \ (GLOG_VERSION_MAJOR > 0 || GLOG_VERSION_MINOR >= 6) if (!google::IsGoogleLoggingInitialized()) +#else + // Check whether pycolmap has already been imported. + if (!py::module_::import("sys").attr("modules").contains("pycolmap")) #endif { google::InitGoogleLogging("");