Skip to content

Commit

Permalink
Use Backward instead of Glog (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymd-stella authored May 2, 2024
1 parent 9ec4045 commit eb55bcf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ else()
message(STATUS "Address/Memory sanitizer: DISABLED")
endif()

set(USE_STACK_TRACE_LOGGER OFF CACHE BOOL "Enable automatic stack trace logger of google-glog")

set(USE_STACK_TRACE_LOGGER OFF CACHE BOOL "Enable automatic stack trace logger of backward-cpp")
if(USE_STACK_TRACE_LOGGER)
find_package(Backward REQUIRED)
message(STATUS "Stack trace logger: ENABLED")
# Glog
find_package(Glog REQUIRED)
include_directories(${GLOG_INCLUDE_DIR})
else()
message(STATUS "Stack trace logger: DISABLED")
endif()
Expand Down
6 changes: 2 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ foreach(EXECUTABLE_TARGET IN LISTS EXECUTABLE_TARGETS)

# setup stack trace logger
if(USE_STACK_TRACE_LOGGER)
target_compile_definitions(${EXECUTABLE_TARGET}
PRIVATE -DUSE_STACK_TRACE_LOGGER)
target_link_libraries(${EXECUTABLE_TARGET} PRIVATE
${GLOG_LIBRARIES})
target_compile_definitions(${EXECUTABLE_TARGET} PRIVATE USE_STACK_TRACE_LOGGER)
target_link_libraries(${EXECUTABLE_TARGET} PRIVATE Backward::Backward)
endif()

# setup google-perftools
Expand Down
5 changes: 2 additions & 3 deletions src/run_slam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace fs = ghc::filesystem;

#ifdef USE_STACK_TRACE_LOGGER
#include <glog/logging.h>
#include <backward.hpp>
#endif

#ifdef USE_GOOGLE_PERFTOOLS
Expand Down Expand Up @@ -168,8 +168,7 @@ void tracking(const std::shared_ptr<stella_vslam_ros::system>& slam_ros,

int main(int argc, char* argv[]) {
#ifdef USE_STACK_TRACE_LOGGER
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
backward::SignalHandling sh;
#endif
rclcpp::init(argc, argv);

Expand Down
5 changes: 2 additions & 3 deletions src/run_slam_offline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
namespace fs = ghc::filesystem;

#ifdef USE_STACK_TRACE_LOGGER
#include <glog/logging.h>
#include <backward.hpp>
#endif

#ifdef USE_GOOGLE_PERFTOOLS
Expand Down Expand Up @@ -313,8 +313,7 @@ void tracking(const std::shared_ptr<stella_vslam_ros::system>& slam_ros,

int main(int argc, char* argv[]) {
#ifdef USE_STACK_TRACE_LOGGER
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
backward::SignalHandling sh;
#endif
rclcpp::init(argc, argv);

Expand Down

0 comments on commit eb55bcf

Please sign in to comment.