From d3ccbce76c519056158b204f8eb5e119238f59a6 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Fri, 20 Nov 2020 16:12:34 +0100 Subject: [PATCH] build: meson: Add remote driver build --- meson.build | 2 +- meson_options.txt | 2 +- src/xrt/drivers/meson.build | 14 ++++++++++++++ src/xrt/drivers/remote/r_hub.c | 3 ++- src/xrt/targets/meson.build | 4 ++++ src/xrt/targets/openxr/meson.build | 4 ++++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 8d1ae88ca..093625c94 100644 --- a/meson.build +++ b/meson.build @@ -147,7 +147,7 @@ if 'v4l2' in drivers endif if 'auto' in drivers - drivers += ['dummy', 'hdk', 'hydra', 'ns', 'psmv'] + drivers += ['dummy', 'hdk', 'hydra', 'ns', 'psmv', 'remote'] endif openhmd = dependency('openhmd', required: openhmd_required) diff --git a/meson_options.txt b/meson_options.txt index 6df07004c..101c952f6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,7 +3,7 @@ option('drivers', type: 'array', - choices: ['auto', 'dummy', 'hdk', 'hydra', 'ns', 'ohmd', 'psmv', 'psvr', 'rs', 'v4l2', 'vive', 'survive', 'daydream', 'arduino'], + choices: ['auto', 'dummy', 'hdk', 'hydra', 'ns', 'ohmd', 'psmv', 'psvr', 'rs', 'v4l2', 'vive', 'survive', 'daydream', 'arduino', 'remote'], value: ['auto'], description: 'Set of drivers to build') diff --git a/src/xrt/drivers/meson.build b/src/xrt/drivers/meson.build index b70ffd2af..805384f4a 100644 --- a/src/xrt/drivers/meson.build +++ b/src/xrt/drivers/meson.build @@ -107,6 +107,20 @@ lib_drv_rs = static_library( build_by_default: 'rs' in drivers, ) +lib_drv_remote = static_library( + 'drv_remote', + files( + 'remote/r_device.c', + 'remote/r_hmd.c', + 'remote/r_hub.c', + 'remote/r_interface.h', + 'remote/r_internal.h', + ), + include_directories: xrt_include, + dependencies: [aux], + build_by_default: 'remote' in drivers, +) + lib_drv_v4l2 = static_library( 'drv_v4l2', files( diff --git a/src/xrt/drivers/remote/r_hub.c b/src/xrt/drivers/remote/r_hub.c index d7600c770..4b038fb26 100644 --- a/src/xrt/drivers/remote/r_hub.c +++ b/src/xrt/drivers/remote/r_hub.c @@ -24,8 +24,9 @@ #include #include #include -#include +#define __USE_MISC // SOL_TCP on C11 +#include /* * diff --git a/src/xrt/targets/meson.build b/src/xrt/targets/meson.build index 32899dc54..3d2c5cd1a 100644 --- a/src/xrt/targets/meson.build +++ b/src/xrt/targets/meson.build @@ -65,6 +65,10 @@ if 'arduino' in drivers driver_libs += [lib_drv_arduino] endif +if 'remote' in drivers + driver_libs += [lib_drv_remote] +endif + subdir('common') subdir('openxr') subdir('cli') diff --git a/src/xrt/targets/openxr/meson.build b/src/xrt/targets/openxr/meson.build index 51d5e9069..351070d9d 100644 --- a/src/xrt/targets/openxr/meson.build +++ b/src/xrt/targets/openxr/meson.build @@ -82,6 +82,10 @@ else ] endif +if 'remote' in drivers + libs += lib_drv_remote +endif + mapfile = 'libopenxr.version' version_script_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) openxr = library(