Skip to content
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
8 changes: 5 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_cmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions cmake/BuildROS1.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -42,5 +46,6 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
liboculus
Boost::system
spdlog::spdlog
)
endif()
4 changes: 3 additions & 1 deletion cmake/BuildROS2.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)

Expand Down
9 changes: 6 additions & 3 deletions include/liboculus/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#pragma once

#include <memory>
#include <spdlog/common.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <utility>

namespace liboculus {

Expand All @@ -60,7 +62,7 @@ class Logger {
Logger::get_logger()->sinks().push_back(s);
}

~Logger() {};
~Logger() {}

private:
static std::shared_ptr<Logger>
Expand All @@ -69,12 +71,13 @@ class Logger {
return std::shared_ptr<Logger>(new Logger(logger_in));
}

Logger(const std::shared_ptr<spdlog::logger> &l = nullptr) : logger_(l) {
explicit Logger(const std::shared_ptr<spdlog::logger> &l = nullptr)
: logger_(l) {
if (!logger_) {
logger_ = std::make_shared<spdlog::logger>("liboculus");
spdlog::register_logger(logger_);
}
};
}

std::shared_ptr<spdlog::logger> logger_;

Expand Down