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

Use Backward instead of Glog #179

Merged
merged 1 commit into from
May 2, 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
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
Loading