Skip to content

Commit

Permalink
Detect glog init for <=0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Nov 26, 2024
1 parent 804d989 commit e359395
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _pyceres/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand Down

0 comments on commit e359395

Please sign in to comment.