diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a6d2ac..fd05f8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4eeee85..646b832 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/run_slam.cc b/src/run_slam.cc index 39c495d..56101e2 100644 --- a/src/run_slam.cc +++ b/src/run_slam.cc @@ -28,7 +28,7 @@ namespace fs = ghc::filesystem; #ifdef USE_STACK_TRACE_LOGGER -#include +#include #endif #ifdef USE_GOOGLE_PERFTOOLS @@ -168,8 +168,7 @@ void tracking(const std::shared_ptr& 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); diff --git a/src/run_slam_offline.cc b/src/run_slam_offline.cc index 7b9b7d5..2233e28 100644 --- a/src/run_slam_offline.cc +++ b/src/run_slam_offline.cc @@ -29,7 +29,7 @@ namespace fs = ghc::filesystem; #ifdef USE_STACK_TRACE_LOGGER -#include +#include #endif #ifdef USE_GOOGLE_PERFTOOLS @@ -313,8 +313,7 @@ void tracking(const std::shared_ptr& 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);