chore: Remove glog deps

This commit is contained in:
Joe Dong
2024-06-19 10:40:57 +08:00
parent 3f6ba4f07c
commit 4e7fb8c209
9 changed files with 64 additions and 11 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ Install deb dependencies
```bash
# assume you have sourced ROS environment, same blow
sudo apt install libgflags-dev nlohmann-json3-dev libgoogle-glog-dev \
sudo apt install libgflags-dev nlohmann-json3-dev \
ros-$ROS_DISTRO-image-transport ros-$ROS_DISTRO-image-publisher ros-$ROS_DISTRO-camera-info-manager \
ros-$ROS_DISTRO-diagnostic-updater ros-$ROS_DISTRO-diagnostic-msgs
```
-6
View File
@@ -48,11 +48,7 @@ foreach (dep IN LISTS dependencies)
endforeach ()
find_package(PkgConfig REQUIRED)
pkg_search_module(GLOG REQUIRED libglog)
if (NOT GLOG_FOUND)
message(FATAL_ERROR "glog is not found")
endif ()
if (USE_RK_HW_DECODER)
pkg_search_module(RK_MPP REQUIRED rockchip_mpp)
@@ -106,14 +102,12 @@ set(COMMON_INCLUDE_DIRS
$<INSTALL_INTERFACE:include>
${ORBBEC_INCLUDE_DIR}
${OpenCV_INCLUDED_DIRS}
${GLOG_INCLUDED_DIRS}
)
set(COMMON_LIBRARIES
${ORBBEC_SDK_LIBRARIES}
${OpenCV_LIBS}
Eigen3::Eigen
${GLOG_LIBRARIES}
-lOrbbecSDK
-L${ORBBEC_LIBS_DIR}
Threads::Threads
@@ -18,6 +18,7 @@
#include <string>
#include <vector>
#include "libobsensor/ObSensor.hpp"
#include "utils.h"
namespace orbbec_camera {
@@ -16,7 +16,6 @@
#pragma once
#include <glog/logging.h>
#include <nlohmann/json.hpp>
#include <memory>
@@ -24,6 +24,8 @@
#include <rockchip/mpp_rc_defs.h>
#include <rockchip/mpp_task.h>
#include <rockchip/rk_mpi.h>
#include "utils.h"
#if defined(USE_LIBYUV)
#include <libyuv.h>
#else
@@ -16,7 +16,6 @@
#pragma once
#include <rclcpp/rclcpp.hpp>
#include <glog/logging.h>
#include <sensor_msgs/msg/imu.hpp>
#include <queue>
#include <mutex>
+58 -1
View File
@@ -16,7 +16,6 @@
#pragma once
#include <ostream>
#include <glog/logging.h>
#include <Eigen/Dense>
#include <tf2/LinearMath/Quaternion.h>
#include <rclcpp/rclcpp.hpp>
@@ -28,6 +27,64 @@
#include "magic_enum/magic_enum.hpp"
#include <sensor_msgs/msg/point_cloud2.hpp>
namespace orbbec_camera {
inline void LogFatal(const char *file, int line, const std::string &message) {
std::cerr << "Check failed at " << file << ":" << line << ": " << message << std::endl;
std::abort();
}
} // namespace orbbec_camera
// Macros for checking conditions and comparing values
#define CHECK(condition) \
(!(condition) ? LogFatal(__FILE__, __LINE__, "Check failed: " #condition) : (void)0)
template <typename T1, typename T2>
void CheckOp(const char *expr, const char *file, int line, T1 val1, T2 val2, bool result) {
if (!result) {
std::ostringstream os;
os << "Check failed: " << expr << " (" << val1 << " vs. " << val2 << ")";
orbbec_camera::LogFatal(file, line, os.str());
}
}
#define CHECK_OP(opname, op, val1, val2) \
CheckOp(#val1 " " #op " " #val2, __FILE__, __LINE__, val1, val2, (val1)op(val2))
#define CHECK_EQ(val1, val2) CHECK_OP(_EQ, ==, val1, val2)
#define CHECK_NE(val1, val2) CHECK_OP(_NE, !=, val1, val2)
#define CHECK_LE(val1, val2) CHECK_OP(_LE, <=, val1, val2)
#define CHECK_LT(val1, val2) CHECK_OP(_LT, <, val1, val2)
#define CHECK_GE(val1, val2) CHECK_OP(_GE, >=, val1, val2)
#define CHECK_GT(val1, val2) CHECK_OP(_GT, >, val1, val2)
// Overload for raw pointers
template <typename T>
T *CheckNotNull(T *ptr, const char *file, int line) {
if (ptr == nullptr) {
std::ostringstream os;
os << "Null pointer passed to CheckNotNull at " << file << ":" << line;
orbbec_camera::LogFatal(file, line, os.str());
}
return ptr;
}
// Template for smart pointers like std::shared_ptr, std::unique_ptr
template <typename T>
T &CheckNotNull(T &ptr, const char *file, int line) {
if (ptr == nullptr) {
std::ostringstream os;
os << "Null pointer passed to CheckNotNull at " << file << ":" << line;
orbbec_camera::LogFatal(file, line, os.str());
}
return ptr;
}
#if defined(CHECK_NOTNULL)
#undef CHECK_NOTNULL
#endif
#define CHECK_NOTNULL(val) CheckNotNull(val, __FILE__, __LINE__)
namespace orbbec_camera {
sensor_msgs::msg::CameraInfo convertToCameraInfo(OBCameraIntrinsic intrinsic,
OBCameraDistortion distortion, int width);
@@ -22,6 +22,8 @@
#include <rclcpp_components/register_node_macro.hpp>
#include <csignal>
#include <sys/mman.h>
#include <unistd.h>
namespace orbbec_camera {
OBCameraNodeDriver::OBCameraNodeDriver(const rclcpp::NodeOptions &node_options)
-1
View File
@@ -16,7 +16,6 @@
#include "orbbec_camera/rk_mpp_decoder.h"
#include <rclcpp/rclcpp.hpp>
#include <glog/logging.h>
#include <magic_enum/magic_enum.hpp>
namespace orbbec_camera {