diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c28c19e..39edcde 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,9 +15,11 @@ jobs: fail-fast: false matrix: env: - - {ROS_DISTRO: noetic} - # We include humble because there are still 22.04 systems (Jetson) out there - - {ROS_DISTRO: humble} + # You need a more modern version of spdlog than provided + # by 20.04; in development could get it from a backports PPA + # but can't during CI + #- {ROS_DISTRO: noetic} + - {ROS_DISTRO: jazzy} - {ROS_DISTRO: kilted} - {ROS_DISTRO: rolling} diff --git a/.github/workflows/ci_cmake.yaml b/.github/workflows/ci_cmake.yaml index 8a52500..6acffe6 100644 --- a/.github/workflows/ci_cmake.yaml +++ b/.github/workflows/ci_cmake.yaml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-24.04 steps: - - name: Install dependencesi with awalsh128/cache-apt-pkgs-action + - name: Install dependencies with awalsh128/cache-apt-pkgs-action uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: libboost-all-dev + packages: libboost-all-dev libspdlog-dev libfmt-dev version: 1.0 - name: Checkout repository diff --git a/cmake/BuildROS1.cmake b/cmake/BuildROS1.cmake index efe7dd6..8bff6f6 100644 --- a/cmake/BuildROS1.cmake +++ b/cmake/BuildROS1.cmake @@ -1,6 +1,10 @@ # Catkin/ROS1 section ===== find_package(Boost REQUIRED COMPONENTS system) +find_package(catkin REQUIRED) +find_package(spdlog REQUIRED) +find_package(Boost REQUIRED COMPONENTS system) + catkin_package( INCLUDE_DIRS include LIBRARIES liboculus @@ -42,5 +46,6 @@ if(CATKIN_ENABLE_TESTING) ${catkin_LIBRARIES} liboculus Boost::system + spdlog::spdlog ) endif() diff --git a/cmake/BuildROS2.cmake b/cmake/BuildROS2.cmake index ae01f1f..29be55c 100644 --- a/cmake/BuildROS2.cmake +++ b/cmake/BuildROS2.cmake @@ -1,10 +1,11 @@ # == ament/ROS2 section ================================= find_package(ament_cmake REQUIRED) +find_package(spdlog REQUIRED) find_package(Boost REQUIRED COMPONENTS system) add_library(oculus SHARED ${oculus_SRCS}) -target_link_libraries(oculus PUBLIC Boost::system) +target_link_libraries(oculus PUBLIC Boost::system spdlog::spdlog) target_include_directories( oculus @@ -30,6 +31,7 @@ install( PATTERN ".git" EXCLUDE ) +ament_export_dependencies(spdlog) ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) ament_export_libraries(oculus) diff --git a/include/liboculus/Logger.h b/include/liboculus/Logger.h index 2ed61b1..07b2f8d 100644 --- a/include/liboculus/Logger.h +++ b/include/liboculus/Logger.h @@ -32,8 +32,10 @@ #pragma once #include +#include #include #include +#include namespace liboculus { @@ -60,7 +62,7 @@ class Logger { Logger::get_logger()->sinks().push_back(s); } - ~Logger() {}; + ~Logger() {} private: static std::shared_ptr @@ -69,12 +71,13 @@ class Logger { return std::shared_ptr(new Logger(logger_in)); } - Logger(const std::shared_ptr &l = nullptr) : logger_(l) { + explicit Logger(const std::shared_ptr &l = nullptr) + : logger_(l) { if (!logger_) { logger_ = std::make_shared("liboculus"); spdlog::register_logger(logger_); } - }; + } std::shared_ptr logger_;