diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f9212063..b60e780bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,10 +170,10 @@ foreach(slam_system IN LISTS EXTERNAL_SLAM_SYSTEMS) pkg_check_modules(${slam_system} ${slam_system}) endif() if(${slam_system}_FOUND) - set(SLAM ON) set(SLAM_NAME ${slam_system}) set(SLAM_LIBRARIES ${${slam_system}_LIBRARIES}) set(SLAM_INCLUDE_DIRS ${${slam_system}_INCLUDE_DIRS}) + # Exit after the first we find. break() endif() endforeach() @@ -188,91 +188,102 @@ set(ILLIXR_PATH option(BUILD_TESTING "Enable building of the test suite?" ON) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(XRT_HAVE_LIBUDEV ON) set(XRT_HAVE_INTERNAL_HID ON) -else() - option_with_deps( - XRT_HAVE_LIBUDEV - "Enable libudev (used for device probing on Linux)" - ON - "UDEV_FOUND" - OFF - ) endif() # cmake-format: off -option(XRT_FEATURE_COLOR_LOG "Enable logging in color on supported platforms" ON) option_with_deps(CMAKE_INTERPROCEDURAL_OPTIMIZATION "Enable inter-procedural (link-time) optimization" DEFAULT OFF DEPENDS HAS_IPO) -option_with_deps(XRT_HAVE_PERCETTO "Enable percetto support" DEPENDS PERCETTO_FOUND) -option_with_deps(XRT_HAVE_WAYLAND "Enable Wayland support" DEPENDS WAYLAND_FOUND WAYLAND_SCANNER_FOUND WAYLAND_PROTOCOLS_FOUND LIBDRM_FOUND) -option_with_deps(XRT_HAVE_WAYLAND_DIRECT "Enable Wayland direct support" DEPENDS XRT_HAVE_WAYLAND LIBDRM_FOUND "WAYLAND_PROTOCOLS_VERSION VERSION_GREATER_EQUAL 1.22") -option_with_deps(XRT_HAVE_XLIB "Enable xlib support" DEPENDS X11_FOUND) -option_with_deps(XRT_HAVE_XRANDR "Enable xlib-xrandr support" DEPENDS XRANDR_FOUND) -option_with_deps(XRT_HAVE_XCB "Enable xcb support" DEPENDS XCB_FOUND) -option_with_deps(XRT_HAVE_VULKAN "Enable Vulkan Graphics API support (also needed for compositor)" DEPENDS VULKAN_FOUND) +# Graphics deps to use (sorted in each group, groups thematic and ordered to handle internal deps: e.g. EGL and SDL2 need OpenGL/GLES) option_with_deps(XRT_HAVE_OPENGL "Enable OpenGL Graphics API support" DEPENDS OPENGL_WITHOUT_GLX_FOUND) option_with_deps(XRT_HAVE_OPENGL_GLX "Enable OpenGL Graphics API support on X11 (GLX)" DEPENDS XRT_HAVE_OPENGL OpenGL_GLX_FOUND) option_with_deps(XRT_HAVE_OPENGLES "Enable OpenGL-ES Graphics API support" DEPENDS OpenGLES_FOUND) + option_with_deps(XRT_HAVE_EGL "Enable OpenGL(-ES) on EGL Graphics API support" DEPENDS EGL_FOUND "XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES") +option_with_deps(XRT_HAVE_SDL2 "Enable use of SDL2" DEPENDS SDL2_FOUND XRT_HAVE_OPENGL) + +option_with_deps(XRT_HAVE_VULKAN "Enable Vulkan Graphics API support (also needed for compositor)" DEPENDS VULKAN_FOUND) +option_with_deps(XRT_HAVE_WAYLAND "Enable Wayland support" DEPENDS WAYLAND_FOUND WAYLAND_SCANNER_FOUND WAYLAND_PROTOCOLS_FOUND LIBDRM_FOUND) +option_with_deps(XRT_HAVE_WAYLAND_DIRECT "Enable Wayland direct support" DEPENDS XRT_HAVE_WAYLAND LIBDRM_FOUND "WAYLAND_PROTOCOLS_VERSION VERSION_GREATER_EQUAL 1.22") +option_with_deps(XRT_HAVE_XCB "Enable xcb support" DEPENDS XCB_FOUND) +option_with_deps(XRT_HAVE_XLIB "Enable xlib support" DEPENDS X11_FOUND) +option_with_deps(XRT_HAVE_XRANDR "Enable xlib-xrandr support" DEPENDS XRANDR_FOUND) + +# System deps to use (sorted) option_with_deps(XRT_HAVE_DBUS "Enable dbus support (for BLE support)" DEPENDS DBUS_FOUND) option_with_deps(XRT_HAVE_LIBBSD "Enable libbsd support" DEPENDS LIBBSD_FOUND) -option_with_deps(XRT_FEATURE_TRACING "Enable debug tracing on supported platforms" DEFAULT OFF DEPENDS XRT_HAVE_PERCETTO) -option_with_deps(XRT_FEATURE_COMPOSITOR_MAIN "Build main compositor host functionality" DEPENDS XRT_HAVE_VULKAN "XRT_HAVE_WAYLAND OR XRT_HAVE_XCB OR ANDROID OR WIN32") -option_with_deps(XRT_FEATURE_OPENXR "Build OpenXR runtime target" DEPENDS XRT_FEATURE_COMPOSITOR_MAIN) -option_with_deps(XRT_FEATURE_IPC "Enable the build of the IPC layer" DEPENDS "NOT WIN32") -option_with_deps(XRT_FEATURE_SERVICE "Enable separate service module for OpenXR runtime" DEPENDS XRT_FEATURE_IPC XRT_FEATURE_OPENXR) +option_with_deps(XRT_HAVE_LIBUDEV "Enable libudev (used for device probing on Linux)" DEPENDS UDEV_FOUND) +option_with_deps(XRT_HAVE_PERCETTO "Enable percetto support" DEPENDS PERCETTO_FOUND) +option_with_deps(XRT_HAVE_SYSTEMD "Enable systemd support" DEPENDS Systemd_FOUND) +option_with_deps(XRT_HAVE_SYSTEM_CJSON "Enable cJSON from system, instead of bundled source" DEPENDS CJSON_FOUND) -option_with_deps(XRT_HAVE_SYSTEMD "Enable systemd support (for socket activation of service)" DEPENDS Systemd_FOUND XRT_FEATURE_SERVICE) -option_with_deps(XRT_INSTALL_SYSTEMD_UNIT_FILES "Install user unit files for systemd socket activation on installation" DEPENDS XRT_HAVE_SYSTEMD) +# SLAM backends (sorted) +option_with_deps(XRT_HAVE_BASALT_SLAM "Enable Basalt support" DEPENDS basalt_FOUND) +option_with_deps(XRT_HAVE_KIMERA_SLAM "Enable Kimera support" DEPENDS kimera_vio_FOUND) + +if(XRT_HAVE_BASALT_SLAM OR XRT_HAVE_KIMERA_SLAM) + set(SLAM_FOUND ON) +endif() + +# Feature configuration (sorted) +option(XRT_FEATURE_COLOR_LOG "Enable logging in color on supported platforms" ON) +option_with_deps(XRT_FEATURE_COMPOSITOR_MAIN "Build main compositor host functionality" DEPENDS XRT_HAVE_VULKAN "XRT_HAVE_WAYLAND OR XRT_HAVE_XCB OR ANDROID OR WIN32") +option_with_deps(XRT_FEATURE_IPC "Enable the build of the IPC layer" DEPENDS "NOT WIN32") +option_with_deps(XRT_FEATURE_OPENXR "Build OpenXR runtime target" DEPENDS XRT_FEATURE_COMPOSITOR_MAIN) +option_with_deps(XRT_FEATURE_RENDERDOC "Enable RenderDoc API" DEPENDS "RT_LIBRARY OR WIN32") +option_with_deps(XRT_FEATURE_SERVICE "Enable separate service module for OpenXR runtime" DEPENDS XRT_FEATURE_IPC XRT_FEATURE_OPENXR) +option_with_deps(XRT_FEATURE_SERVICE_SYSTEMD "Enable systemd socket activation of the service" DEPENDS XRT_HAVE_SYSTEMD XRT_FEATURE_SERVICE) +option_with_deps(XRT_FEATURE_SLAM "Enable SLAM tracking support" DEPENDS XRT_HAVE_OPENCV SLAM_FOUND) +option_with_deps(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" DEPENDS "NOT ANDROID") +option_with_deps(XRT_FEATURE_TRACING "Enable debug tracing on supported platforms" DEFAULT OFF DEPENDS XRT_HAVE_PERCETTO) + +# systemd detailed config +option_with_deps(XRT_INSTALL_SYSTEMD_UNIT_FILES "Install user unit files for systemd socket activation on installation" DEPENDS XRT_FEATURE_SERVICE_SYSTEMD) option_with_deps(XRT_INSTALL_ABSOLUTE_SYSTEMD_UNIT_FILES "Use an absolute path to monado-system in installed user unit files for systemd socket activation" DEPENDS XRT_INSTALL_SYSTEMD_UNIT_FILES) -option_with_deps(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" DEPENDS "NOT ANDROID") -option_with_deps(XRT_FEATURE_RENDERDOC "Enable RenderDoc API" DEPENDS "RT_LIBRARY OR WIN32") - - -option_with_deps(XRT_HAVE_LIBUSB "Enable libusb (used for most drivers)" DEPENDS LIBUSB1_FOUND) +# Driver deps to use (sorted, though there are some internal dependencies) +option_with_deps(XRT_HAVE_FFMPEG "Enable ffmpeg testing video driver" DEPENDS FFMPEG_FOUND) +option_with_deps(XRT_HAVE_GST "Enable gstreamer" DEPENDS GST_FOUND) option_with_deps(XRT_HAVE_HIDAPI "Enable libhidapi (used for PSVR)" DEPENDS HIDAPI_FOUND) option_with_deps(XRT_HAVE_JPEG "Enable jpeg code (used for some video drivers)" DEPENDS JPEG_FOUND) -option_with_deps(XRT_HAVE_OPENCV "Enable OpenCV backend" DEPENDS OpenCV_FOUND) +option_with_deps(XRT_HAVE_LIBUSB "Enable libusb (used for most drivers)" DEPENDS LIBUSB1_FOUND) option_with_deps(XRT_HAVE_LIBUVC "Enable libuvc video driver" DEPENDS LIBUVC_FOUND XRT_HAVE_LIBUSB) -option_with_deps(XRT_HAVE_FFMPEG "Enable ffmpeg testing video driver" DEPENDS FFMPEG_FOUND) -option_with_deps(XRT_HAVE_SDL2 "Enable use of SDL2" DEPENDS SDL2_FOUND XRT_HAVE_OPENGL) -option_with_deps(XRT_HAVE_SYSTEM_CJSON "Enable cJSON from system, instead of bundled source" DEPENDS CJSON_FOUND) -option_with_deps(XRT_HAVE_GST "Enable gstreamer" DEPENDS GST_FOUND) -option_with_deps(XRT_HAVE_REALSENSE "Enable RealSense support" DEPENDS realsense2_FOUND) option_with_deps(XRT_HAVE_ONNXRUNTIME "Enable ONNX runtime support" DEPENDS ONNXRUNTIME_FOUND) -option_with_deps(XRT_HAVE_KIMERA_SLAM "Enable Kimera support" DEPENDS kimera_vio_FOUND) -option_with_deps(XRT_HAVE_BASALT_SLAM "Enable Basalt support" DEPENDS basalt_FOUND) -option_with_deps(XRT_HAVE_SLAM "Enable SLAM tracking support" DEPENDS SLAM XRT_HAVE_OPENCV) -option_with_deps(XRT_BUILD_DRIVER_PSVR "Enable PSVR HMD driver" DEPENDS XRT_HAVE_HIDAPI) -option_with_deps(XRT_BUILD_DRIVER_REALSENSE "Enable RealSense device driver" DEPENDS XRT_HAVE_REALSENSE) -option_with_deps(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Valve Index, and their controllers" DEPENDS ZLIB_FOUND XRT_HAVE_LINUX) -option_with_deps(XRT_BUILD_DRIVER_OHMD "Enable OpenHMD driver" DEPENDS OPENHMD_FOUND) -option_with_deps(XRT_BUILD_DRIVER_HANDTRACKING "Enable Camera Hand Tracking driver" DEPENDS XRT_HAVE_ONNXRUNTIME XRT_HAVE_OPENCV XRT_HAVE_V4L2) -option_with_deps(XRT_BUILD_DRIVER_DAYDREAM "Enable the Google Daydream View controller driver (BLE, via D-Bus)" DEPENDS XRT_HAVE_DBUS) +option_with_deps(XRT_HAVE_OPENCV "Enable OpenCV backend" DEPENDS OpenCV_FOUND) +option_with_deps(XRT_HAVE_REALSENSE "Enable RealSense support" DEPENDS realsense2_FOUND) + +# Drivers to build (sorted) +option_with_deps(XRT_BUILD_DRIVER_ANDROID "Enable Android sensors driver" DEPENDS ANDROID) option_with_deps(XRT_BUILD_DRIVER_ARDUINO "Enable Arduino input device with BLE via via D-Bus" DEPENDS XRT_HAVE_DBUS) +option_with_deps(XRT_BUILD_DRIVER_DAYDREAM "Enable the Google Daydream View controller driver (BLE, via D-Bus)" DEPENDS XRT_HAVE_DBUS) +option_with_deps(XRT_BUILD_DRIVER_DEPTHAI "DepthAI" DEPENDS depthai_FOUND) +option_with_deps(XRT_BUILD_DRIVER_EUROC "Enable EuRoC dataset driver for SLAM evaluation" DEPENDS XRT_HAVE_OPENCV) +option_with_deps(XRT_BUILD_DRIVER_HANDTRACKING "Enable Camera Hand Tracking driver" DEPENDS XRT_HAVE_ONNXRUNTIME XRT_HAVE_OPENCV XRT_HAVE_V4L2) +option_with_deps(XRT_BUILD_DRIVER_HDK "Enable HDK driver" DEPENDS XRT_HAVE_INTERNAL_HID) +option_with_deps(XRT_BUILD_DRIVER_HYDRA "Enable Hydra driver" DEPENDS XRT_HAVE_INTERNAL_HID) option_with_deps(XRT_BUILD_DRIVER_ILLIXR "Enable ILLIXR driver" DEPENDS ILLIXR_PATH) -option(XRT_BUILD_DRIVER_DUMMY "Enable dummy driver" ON) -option_with_deps(XRT_BUILD_DRIVER_ULV2 "Enable Ultraleap v2 driver" DEPENDS LeapV2_FOUND) +option_with_deps(XRT_BUILD_DRIVER_NS "Enable North Star driver" DEPENDS XRT_HAVE_INTERNAL_HID) +option_with_deps(XRT_BUILD_DRIVER_OHMD "Enable OpenHMD driver" DEPENDS OPENHMD_FOUND) +option_with_deps(XRT_BUILD_DRIVER_PSMV "Enable Playstation Move driver" DEPENDS XRT_HAVE_INTERNAL_HID) +option_with_deps(XRT_BUILD_DRIVER_PSVR "Enable PSVR HMD driver" DEPENDS XRT_HAVE_HIDAPI) +option_with_deps(XRT_BUILD_DRIVER_QWERTY "Enable Qwerty driver" DEPENDS XRT_HAVE_SDL2) +option_with_deps(XRT_BUILD_DRIVER_REALSENSE "Enable RealSense device driver" DEPENDS XRT_HAVE_REALSENSE) option_with_deps(XRT_BUILD_DRIVER_REMOTE "Enable remote debugging driver" DEPENDS "XRT_HAVE_LINUX OR ANDROID") +option_with_deps(XRT_BUILD_DRIVER_SURVIVE "Enable libsurvive driver" DEPENDS SURVIVE_FOUND) +option_with_deps(XRT_BUILD_DRIVER_ULV2 "Enable Ultraleap v2 driver" DEPENDS LeapV2_FOUND) +option_with_deps(XRT_BUILD_DRIVER_VF "Build video frame driver (for video file support, uses gstreamer)" DEPENDS XRT_HAVE_GST) +option_with_deps(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Valve Index, and their controllers" DEPENDS ZLIB_FOUND XRT_HAVE_LINUX) option_with_deps(XRT_BUILD_DRIVER_WMR "Enable Windows Mixed Reality driver" DEPENDS "NOT WIN32") +option(XRT_BUILD_DRIVER_DUMMY "Enable dummy driver" ON) option(XRT_BUILD_SAMPLES "Enable compiling sample code implementations that will not be linked into any final targets" ON) -option_with_deps(XRT_BUILD_DRIVER_HDK "Enable HDK driver" DEPENDS XRT_HAVE_INTERNAL_HID) -option_with_deps(XRT_BUILD_DRIVER_PSMV "Enable Playstation Move driver" DEPENDS XRT_HAVE_INTERNAL_HID) -option_with_deps(XRT_BUILD_DRIVER_HYDRA "Enable Hydra driver" DEPENDS XRT_HAVE_INTERNAL_HID) -option_with_deps(XRT_BUILD_DRIVER_NS "Enable North Star driver" DEPENDS XRT_HAVE_INTERNAL_HID) -option_with_deps(XRT_BUILD_DRIVER_VF "Build video frame driver (for video file support, uses gstreamer)" DEPENDS XRT_HAVE_GST) -option_with_deps(XRT_BUILD_DRIVER_DEPTHAI "DepthAI" DEPENDS depthai_FOUND) -option_with_deps(XRT_BUILD_DRIVER_SURVIVE "Enable libsurvive driver" DEPENDS SURVIVE_FOUND) -option_with_deps(XRT_BUILD_DRIVER_ANDROID "Enable Android sensors driver" DEPENDS ANDROID) -option_with_deps(XRT_BUILD_DRIVER_QWERTY "Enable Qwerty driver" DEPENDS XRT_HAVE_SDL2) -option_with_deps(XRT_BUILD_DRIVER_EUROC "Enable EuRoC dataset driver for SLAM evaluation" DEPENDS XRT_HAVE_OPENCV) - # cmake-format: on +# Most users won't touch these. +mark_as_advanced(XRT_FEATURE_COMPOSITOR_MAIN XRT_FEATURE_OPENXR) + +# Defaults for OpenXR layer support if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH) set(XRT_FEATURE_OPENXR_LAYER_DEPTH ON) endif() @@ -289,8 +300,6 @@ if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_EQUIRECT1) set(XRT_FEATURE_OPENXR_LAYER_EQUIRECT1 ON) endif() -# Most users won't touch these. -mark_as_advanced(XRT_FEATURE_COMPOSITOR_MAIN XRT_FEATURE_OPENXR) # You can set this from a superproject to add a driver # All drivers must be listed in here to be included in the generated header! list( @@ -439,7 +448,7 @@ message(STATUS "# ONNXRUNTIME: ${XRT_HAVE_ONNXRUNTIME}") message(STATUS "# SYSTEM_CJSON: ${XRT_HAVE_SYSTEM_CJSON}") message(STATUS "# KIMERA: ${XRT_HAVE_KIMERA_SLAM}") message(STATUS "# BASALT: ${XRT_HAVE_BASALT_SLAM}") -message(STATUS "# SLAM: ${XRT_HAVE_SLAM}") +message(STATUS "# SLAM: ${XRT_FEATURE_SLAM}") message(STATUS "#") message(STATUS "# FEATURE_IPC: ${XRT_FEATURE_IPC}") message(STATUS "# FEATURE_COMPOSITOR_MAIN: ${XRT_FEATURE_COMPOSITOR_MAIN}") diff --git a/doc/changes/misc_fixes/mr.1262.md b/doc/changes/misc_fixes/mr.1262.md new file mode 100644 index 000000000..22a736750 --- /dev/null +++ b/doc/changes/misc_fixes/mr.1262.md @@ -0,0 +1,2 @@ +- Build system will now error out, rather than silently disable the option, if you specifically enable an option whose dependencies are unavailable. +- Build system option: `XRT_HAVE_SLAM` has been renamed to `XRT_FEATURE_SLAM` to more accurately describe it, with corresponding move from `xrt_config_have.h` to `xrt_config_build.h`. diff --git a/src/external/CMakeLists.txt b/src/external/CMakeLists.txt index f0dcf53fd..b001757f2 100644 --- a/src/external/CMakeLists.txt +++ b/src/external/CMakeLists.txt @@ -50,7 +50,7 @@ target_include_directories( ) # External SLAM tracking -if(SLAM) +if(XRT_FEATURE_SLAM) add_library(xrt-external-slam STATIC slam_tracker/slam_tracker.hpp) set_target_properties(xrt-external-slam PROPERTIES LINKER_LANGUAGE CXX) target_include_directories( diff --git a/src/xrt/auxiliary/CMakeLists.txt b/src/xrt/auxiliary/CMakeLists.txt index 5ce18f084..8355a7eea 100644 --- a/src/xrt/auxiliary/CMakeLists.txt +++ b/src/xrt/auxiliary/CMakeLists.txt @@ -144,7 +144,7 @@ if(XRT_HAVE_OPENCV) target_include_directories(aux_tracking SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS}) target_link_libraries(aux_tracking PUBLIC ${OpenCV_LIBRARIES}) endif() -if(XRT_HAVE_SLAM) +if(XRT_FEATURE_SLAM) target_sources(aux_tracking PRIVATE tracking/t_tracker_slam.cpp) target_link_libraries(aux_tracking PRIVATE xrt-external-slam) endif() diff --git a/src/xrt/drivers/euroc/euroc_runner.c b/src/xrt/drivers/euroc/euroc_runner.c index bfa0042be..e1d61bd60 100644 --- a/src/xrt/drivers/euroc/euroc_runner.c +++ b/src/xrt/drivers/euroc/euroc_runner.c @@ -13,13 +13,15 @@ #include "tracking/t_tracking.h" #include "util/u_logging.h" #include "util/u_misc.h" + #include "xrt/xrt_config_have.h" +#include "xrt/xrt_config_build.h" #include "xrt/xrt_defines.h" #include "xrt/xrt_frame.h" #include "xrt/xrt_frameserver.h" #include "xrt/xrt_tracking.h" -#if !defined(XRT_HAVE_SLAM) +#if !defined(XRT_FEATURE_SLAM) void euroc_run_dataset(const char *euroc_path, diff --git a/src/xrt/drivers/realsense/rs_prober.c b/src/xrt/drivers/realsense/rs_prober.c index 23e15d292..ac661bf0a 100644 --- a/src/xrt/drivers/realsense/rs_prober.c +++ b/src/xrt/drivers/realsense/rs_prober.c @@ -11,6 +11,7 @@ #include #include +#include "xrt/xrt_config_build.h" #include "xrt/xrt_config_have.h" #include "xrt/xrt_prober.h" @@ -164,7 +165,7 @@ create_tracked_rs_device(struct xrt_prober *xp) rs2_error *e = NULL; struct rs_container rsc = {0}; int expected_tracking = debug_get_num_option_rs_tracking(); -#ifdef XRT_HAVE_SLAM +#ifdef XRT_FEATURE_SLAM bool external_slam_supported = true; #else bool external_slam_supported = false; diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index 87215fdfb..b479c464b 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -12,6 +12,7 @@ */ #include "xrt/xrt_config_have.h" +#include "xrt/xrt_config_build.h" #include "xrt/xrt_config_os.h" #include "xrt/xrt_device.h" @@ -1218,7 +1219,7 @@ wmr_hmd_slam_track(struct wmr_hmd *wh) struct xrt_slam_sinks *sinks = NULL; -#ifdef XRT_HAVE_SLAM +#ifdef XRT_FEATURE_SLAM int create_status = t_slam_create(&wh->slam.xfctx, NULL, &wh->slam.tracker, &sinks); if (create_status != 0) { return NULL; @@ -1266,7 +1267,7 @@ wmr_hmd_create(enum wmr_headset_type hmd_type, // Decide whether to initialize the SLAM tracker bool slam_wanted = debug_get_bool_option_wmr_slam(); -#ifdef XRT_HAVE_SLAM +#ifdef XRT_FEATURE_SLAM bool slam_supported = true; #else bool slam_supported = false; diff --git a/src/xrt/include/xrt/xrt_config_build.h.cmake_in b/src/xrt/include/xrt/xrt_config_build.h.cmake_in index e92cace14..e8ad03d3e 100644 --- a/src/xrt/include/xrt/xrt_config_build.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_build.h.cmake_in @@ -1,4 +1,4 @@ -// Copyright 2020-2021, Collabora, Ltd. +// Copyright 2020-2022, Collabora, Ltd. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -9,26 +9,18 @@ #pragma once -#cmakedefine XRT_FEATURE_IPC - -#cmakedefine XRT_FEATURE_COMPOSITOR_MAIN - -#cmakedefine XRT_FEATURE_SERVICE - -#cmakedefine XRT_FEATURE_OPENXR - -#cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE - -#cmakedefine XRT_FEATURE_OPENXR_LAYER_CYLINDER - -#cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH - -#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT2 - -#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT1 +/* keep sorted */ #cmakedefine XRT_FEATURE_COLOR_LOG - -#cmakedefine XRT_FEATURE_TRACING - +#cmakedefine XRT_FEATURE_COMPOSITOR_MAIN +#cmakedefine XRT_FEATURE_IPC +#cmakedefine XRT_FEATURE_OPENXR +#cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE +#cmakedefine XRT_FEATURE_OPENXR_LAYER_CYLINDER +#cmakedefine XRT_FEATURE_OPENXR_LAYER_DEPTH +#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT1 +#cmakedefine XRT_FEATURE_OPENXR_LAYER_EQUIRECT2 #cmakedefine XRT_FEATURE_RENDERDOC +#cmakedefine XRT_FEATURE_SERVICE +#cmakedefine XRT_FEATURE_SLAM +#cmakedefine XRT_FEATURE_TRACING diff --git a/src/xrt/include/xrt/xrt_config_have.h.cmake_in b/src/xrt/include/xrt/xrt_config_have.h.cmake_in index a4c954674..7d945b34a 100644 --- a/src/xrt/include/xrt/xrt_config_have.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_have.h.cmake_in @@ -1,4 +1,4 @@ -// Copyright 2019-2020, Collabora, Ltd. +// Copyright 2019-2022, Collabora, Ltd. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -9,26 +9,27 @@ #pragma once +/* keep sorted */ + +#cmakedefine XRT_HAVE_BASALT_SLAM #cmakedefine XRT_HAVE_DBUS -#cmakedefine XRT_HAVE_LIBBSD #cmakedefine XRT_HAVE_EGL #cmakedefine XRT_HAVE_FFMPEG #cmakedefine XRT_HAVE_GST +#cmakedefine XRT_HAVE_HIDAPI #cmakedefine XRT_HAVE_JPEG +#cmakedefine XRT_HAVE_KIMERA_SLAM +#cmakedefine XRT_HAVE_LIBBSD #cmakedefine XRT_HAVE_LIBUDEV #cmakedefine XRT_HAVE_LIBUSB -#cmakedefine XRT_HAVE_HIDAPI #cmakedefine XRT_HAVE_LIBUVC #cmakedefine XRT_HAVE_OPENCV #cmakedefine XRT_HAVE_OPENGL #cmakedefine XRT_HAVE_OPENGLES +#cmakedefine XRT_HAVE_PERCETTO #cmakedefine XRT_HAVE_SDL2 #cmakedefine XRT_HAVE_SYSTEMD #cmakedefine XRT_HAVE_V4L2 #cmakedefine XRT_HAVE_VULKAN -#cmakedefine XRT_HAVE_PERCETTO -#cmakedefine XRT_HAVE_KIMERA_SLAM -#cmakedefine XRT_HAVE_BASALT_SLAM -#cmakedefine XRT_HAVE_SLAM #cmakedefine XRT_HAVE_WAYLAND #cmakedefine XRT_HAVE_WAYLAND_DIRECT diff --git a/src/xrt/state_trackers/prober/p_tracking.c b/src/xrt/state_trackers/prober/p_tracking.c index c24d674e7..58beded52 100644 --- a/src/xrt/state_trackers/prober/p_tracking.c +++ b/src/xrt/state_trackers/prober/p_tracking.c @@ -13,6 +13,8 @@ #include "xrt/xrt_config_have.h" #include "xrt/xrt_config_drivers.h" +#include "xrt/xrt_config_build.h" + #ifdef XRT_HAVE_OPENCV #include "tracking/t_tracking.h" #endif @@ -243,7 +245,7 @@ p_factory_ensure_frameserver(struct p_factory *fact) XRT_MAYBE_UNUSED static bool p_factory_ensure_slam_frameserver(struct p_factory *fact) { - //! @todo The check for (XRT_HAVE_SLAM && XRT_BUILD_DRIVER_* && + //! @todo The check for (XRT_FEATURE_SLAM && XRT_BUILD_DRIVER_* && //! debug_flag_is_correct) is getting duplicated in: p_open_video_device, //! p_list_video_devices, and p_factory_ensure_slam_frameserver (here) with //! small differences. Incorrectly modifying one will mess the others. @@ -263,7 +265,7 @@ p_factory_ensure_slam_frameserver(struct p_factory *fact) xrt_prober_open_video_device(&fact->p->base, NULL, &fact->xfctx, &fact->xfs); assert(fact->xfs->source_id == 0xECD0FEED && "xfs is not Euroc, unsynced open_video_device?"); -#ifdef XRT_HAVE_SLAM +#ifdef XRT_FEATURE_SLAM int ret = t_slam_create(&fact->xfctx, NULL, &fact->xts, &sinks); if (ret != 0) { U_LOG_W("Unable to initialize SLAM tracking, the Euroc driver will not be tracked"); @@ -288,7 +290,7 @@ p_factory_ensure_slam_frameserver(struct p_factory *fact) xrt_prober_open_video_device(&fact->p->base, NULL, &fact->xfctx, &fact->xfs); assert(fact->xfs->source_id == 0x2EA15E115E && "xfs is not RealSense, unsynced open_video_device?"); -#ifdef XRT_HAVE_SLAM +#ifdef XRT_FEATURE_SLAM int ret = t_slam_create(&fact->xfctx, NULL, &fact->xts, &sinks); if (ret != 0) { U_LOG_W("Unable to initialize SLAM tracking, the RealSense driver will not be tracked"); @@ -412,7 +414,7 @@ p_factory_create_tracked_slam(struct xrt_tracking_factory *xfact, struct xrt_device *xdev, struct xrt_tracked_slam **out_xts) { -#ifdef XRT_HAVE_SLAM +#ifdef XRT_FEATURE_SLAM struct p_factory *fact = p_factory(xfact); struct xrt_tracked_slam *xts = NULL; diff --git a/src/xrt/targets/cli/cli_cmd_slambatch.c b/src/xrt/targets/cli/cli_cmd_slambatch.c index 22203a026..e3e60a623 100644 --- a/src/xrt/targets/cli/cli_cmd_slambatch.c +++ b/src/xrt/targets/cli/cli_cmd_slambatch.c @@ -9,6 +9,7 @@ #include "euroc/euroc_interface.h" #include "os/os_threading.h" #include "util/u_logging.h" +#include "xrt/xrt_config_build.h" #include "xrt/xrt_config_have.h" #include "xrt/xrt_config_drivers.h" @@ -17,7 +18,7 @@ #define P(...) fprintf(stderr, __VA_ARGS__) #define I(...) U_LOG(U_LOGGING_INFO, __VA_ARGS__) -#if defined(XRT_HAVE_SLAM) && defined(XRT_BUILD_DRIVER_EUROC) +#if defined(XRT_FEATURE_SLAM) && defined(XRT_BUILD_DRIVER_EUROC) static bool should_exit = false; @@ -34,7 +35,7 @@ int cli_cmd_slambatch(int argc, const char **argv) { -#if !defined(XRT_HAVE_SLAM) +#if !defined(XRT_FEATURE_SLAM) P("No SLAM system built.\n"); return EXIT_FAILURE; #elif !defined(XRT_BUILD_DRIVER_EUROC)