From a409ed61412934c1c3cbff4fd923955103bca6a7 Mon Sep 17 00:00:00 2001
From: Mateo de Mayo <mateo.demayo@collabora.com>
Date: Fri, 1 Oct 2021 21:29:51 -0300
Subject: [PATCH] d/rs: Fix build errors and warnings when compiling without a
 SLAM dependency

---
 src/xrt/drivers/euroc/euroc_device.c | 2 +-
 src/xrt/drivers/realsense/rs_hdev.c  | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xrt/drivers/euroc/euroc_device.c b/src/xrt/drivers/euroc/euroc_device.c
index 4c9ff74d3..4ca84342c 100644
--- a/src/xrt/drivers/euroc/euroc_device.c
+++ b/src/xrt/drivers/euroc/euroc_device.c
@@ -108,7 +108,7 @@ euroc_device_update_inputs(struct xrt_device *xdev)
 //! Corrections specific for original euroc datasets and Kimera.
 //! If your datasets comes from a different camera you should probably
 //! use a different pose correction function.
-static inline struct xrt_pose
+XRT_MAYBE_UNUSED static inline struct xrt_pose
 euroc_device_correct_pose_from_kimera(struct xrt_pose pose)
 {
 	//! @todo Implement proper pose corrections for the original euroc datasets
diff --git a/src/xrt/drivers/realsense/rs_hdev.c b/src/xrt/drivers/realsense/rs_hdev.c
index ee28647cd..b0cd18fa8 100644
--- a/src/xrt/drivers/realsense/rs_hdev.c
+++ b/src/xrt/drivers/realsense/rs_hdev.c
@@ -194,7 +194,7 @@ rs_hdev_update_inputs(struct xrt_device *xdev)
 }
 
 //! Specific pose corrections for Kimera and the D455 camera
-static inline struct xrt_pose
+XRT_MAYBE_UNUSED static inline struct xrt_pose
 rs_hdev_correct_pose_from_kimera(struct xrt_pose pose)
 {
 	// Correct swapped axes
@@ -806,6 +806,7 @@ rs_hdev_fs_create(struct rs_hdev *rs, int device_idx)
 static bool
 rs_hdev_slam_track(struct rs_hdev *rs, struct xrt_prober *xp)
 {
+#ifdef XRT_HAVE_SLAM
 	struct xrt_slam_sinks *sinks = NULL;
 
 	int create_status = t_slam_create(&rs->xfctx, &rs->slam, &sinks);
@@ -822,8 +823,10 @@ rs_hdev_slam_track(struct rs_hdev *rs, struct xrt_prober *xp)
 	if (start_status != 0) {
 		return false;
 	}
-
 	return true;
+#else
+	return false;
+#endif
 }