diff --git a/src/xrt/targets/common/CMakeLists.txt b/src/xrt/targets/common/CMakeLists.txt index d3c894476..94623234a 100644 --- a/src/xrt/targets/common/CMakeLists.txt +++ b/src/xrt/targets/common/CMakeLists.txt @@ -45,6 +45,11 @@ if(XRT_BUILD_DRIVER_NS) target_link_libraries(target_lists PRIVATE drv_ns) endif() +if(XRT_BUILD_DRIVER_WMR) + target_sources(target_lists PRIVATE target_builder_wmr.c) + target_link_libraries(target_lists PRIVATE drv_wmr) +endif() + ### # Drivers # diff --git a/src/xrt/targets/common/target_builder_interface.h b/src/xrt/targets/common/target_builder_interface.h index 328f3fc84..e380dd925 100644 --- a/src/xrt/targets/common/target_builder_interface.h +++ b/src/xrt/targets/common/target_builder_interface.h @@ -1,4 +1,4 @@ -// Copyright 2022, Collabora, Ltd. +// Copyright 2022-2023, Collabora, Ltd. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -43,6 +43,10 @@ #define T_BUILDER_SIMULAVR #endif +#if defined(XRT_BUILD_DRIVER_WMR) || defined(XRT_DOXYGEN) +#define T_BUILDER_WMR +#endif + /* * @@ -106,3 +110,11 @@ t_builder_simulated_create(void); struct xrt_builder * t_builder_simula_create(void); #endif + +#ifdef T_BUILDER_WMR +/*! + * Builder for Windows Mixed Reality headsets + */ +struct xrt_builder * +t_builder_wmr_create(void); +#endif diff --git a/src/xrt/targets/common/target_builder_wmr.c b/src/xrt/targets/common/target_builder_wmr.c new file mode 100644 index 000000000..826a0d5e4 --- /dev/null +++ b/src/xrt/targets/common/target_builder_wmr.c @@ -0,0 +1,92 @@ +// Copyright 2022-2023, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief @ref drv_wmr driver builder. + * @author Jakob Bornecrantz + * @ingroup xrt_iface + */ + +#include "xrt/xrt_config_drivers.h" +#include "xrt/xrt_prober.h" + +#include "util/u_misc.h" +#include "util/u_logging.h" +#include "util/u_builders.h" +#include "util/u_config_json.h" +#include "util/u_system_helpers.h" + +#include "target_builder_interface.h" + +#include "wmr/wmr_interface.h" + +#include + +#ifndef XRT_BUILD_DRIVER_WMR +#error "Must only be built with XRT_BUILD_DRIVER_WMR set" +#endif + + +/* + * + * Various helper functions and lists. + * + */ + +static const char *driver_list[] = { + "wmr", +}; + + +/* + * + * Member functions. + * + */ + +static xrt_result_t +wmr_estimate_system(struct xrt_builder *xb, + cJSON *config, + struct xrt_prober *xp, + struct xrt_builder_estimate *out_estimate) +{ + return XRT_SUCCESS; +} + +static xrt_result_t +wmr_open_system(struct xrt_builder *xb, + cJSON *config, + struct xrt_prober *xp, + struct xrt_system_devices **out_xsysd, + struct xrt_space_overseer **out_xso) +{ + return XRT_SUCCESS; +} + +static void +wmr_destroy(struct xrt_builder *xb) +{ + free(xb); +} + + +/* + * + * 'Exported' functions. + * + */ + +struct xrt_builder * +t_builder_wmr_create(void) +{ + struct xrt_builder *xb = U_TYPED_CALLOC(struct xrt_builder); + xb->estimate_system = wmr_estimate_system; + xb->open_system = wmr_open_system; + xb->destroy = wmr_destroy; + xb->identifier = "wmr"; + xb->name = "Windows Mixed Reality"; + xb->driver_identifiers = driver_list; + xb->driver_identifier_count = ARRAY_SIZE(driver_list); + + return xb; +} diff --git a/src/xrt/targets/common/target_lists.c b/src/xrt/targets/common/target_lists.c index d107d5cea..727d4bd1c 100644 --- a/src/xrt/targets/common/target_lists.c +++ b/src/xrt/targets/common/target_lists.c @@ -1,4 +1,4 @@ -// Copyright 2019-2022, Collabora, Ltd. +// Copyright 2019-2023, Collabora, Ltd. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -124,6 +124,10 @@ xrt_builder_create_func_t target_builder_list[] = { t_builder_north_star_create, #endif // T_BUILDER_NS +#ifdef T_BUILDER_WMR + t_builder_wmr_create, +#endif // T_BUILDER_WMR + #ifdef T_BUILDER_LEGACY t_builder_legacy_create, #endif // T_BUILDER_LEGACY