build: port to meson

This commit is contained in:
Drew DeVault 2019-09-24 09:43:43 -04:00 committed by Jakob Bornecrantz
parent c6586cfd1e
commit 064aef3526
26 changed files with 3456 additions and 9 deletions

2528
doc/Doxyfile.meson.in Normal file

File diff suppressed because it is too large Load diff

30
doc/meson.build Normal file
View file

@ -0,0 +1,30 @@
# Copyright 2018-2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
doxyconf = configuration_data()
doxyconf.set('SRCDIR', meson.source_root())
doxyconf.set('BUILDDIR', meson.build_root())
doxyconf.set('CURBUILDDIR', meson.current_build_dir())
if get_option('doxygen-warn-undocumented') and get_option('doxygen-extract-all')
error('doxygen-warn-undocumented and doxygen-extract-all are mutually incompatible')
endif
if get_option('doxygen-warn-undocumented')
doxyconf.set('DOXYGEN_WARN_UNDOCUMENTED', 'YES')
else
doxyconf.set('DOXYGEN_WARN_UNDOCUMENTED', 'NO')
endif
if get_option('doxygen-extract-all')
doxyconf.set('DOXYGEN_EXTRACT_ALL', 'YES')
else
doxyconf.set('DOXYGEN_EXTRACT_ALL', 'NO')
endif
doxyfile = configure_file(input: 'Doxyfile.meson.in',
output: 'Doxyfile', configuration: doxyconf, install: false)
html = custom_target('docs',
input: doxyfile, output: 'html', command: [doxygen, doxyfile],
build_by_default: true)

157
meson.build Normal file
View file

@ -0,0 +1,157 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
project(
'xrt',
['c', 'cpp'],
version: '0.1.0',
license: 'BSL-1.0',
meson_version: '>=0.49.0',
default_options: [
'c_std=c11',
'warning_level=2',
],
)
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
add_project_arguments(cc.get_supported_arguments([
'-D_XOPEN_SOURCE=700',
'-pedantic',
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
]), language: 'c')
add_project_arguments(cpp.get_supported_arguments([
'-D_XOPEN_SOURCE=700',
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
'-Wno-deprecated-copy', # Eigen
]), language: 'cpp')
glslangValidator = find_program('glslangValidator')
avcodec = dependency('libavcodec', required: false)
eigen3 = dependency('eigen3')
libjpeg = dependency('libjpeg', required: false)
libusb = dependency('libusb-1.0', required: false)
opencv = dependency('opencv4', required: get_option('tracking'))
opengl = dependency('gl')
sdl2 = dependency('sdl2', required: get_option('gui'))
udev = dependency('libudev', required: false)
libuvc = dependency('libuvc', required: false)
vulkan = dependency('vulkan')
doxygen = find_program('doxygen', required: get_option('docs'))
pthreads = cc.find_library('pthread', required: true)
if get_option('tracking').enabled() or get_option('tracking').auto()
build_tracking = opencv.found()
else
build_tracking = false
endif
# TODO: make these behave well when not present
x11 = dependency('x11', required: false)
xcb = dependency('xcb', required: false)
xcb_randr = dependency('xcb-randr', required: false)
wayland = dependency('wayland-client', required: false)
hidapi_required = false
openhmd_required = false
v4l2_required = false
drivers = get_option('drivers')
if 'ohmd' in drivers
openhmd_required = true
endif
if 'hdk' in drivers or 'psvr' in drivers
hidapi_required = true
endif
if 'v4l2' in drivers
v4l2_required = true
endif
if 'auto' in drivers
drivers += ['psmv', 'hydra']
endif
openhmd = dependency('openhmd', required: openhmd_required)
hidapi = dependency('hidapi', required: hidapi_required)
v4l2 = dependency('libv4l2', required: v4l2_required)
if openhmd.found() and ('auto' in drivers or 'ohmd' in drivers)
if 'ohmd' not in drivers
drivers += ['ohmd']
endif
endif
if hidapi.found() and ('auto' in drivers or 'psvr' in drivers or 'hdk' in drivers)
if 'psvr' not in drivers
drivers += ['psvr']
endif
if 'hdk' not in drivers
drivers += ['hdk']
endif
endif
if v4l2.found() and ('auto' in drivers or 'v4l2' in drivers)
if 'v4l2' not in drivers
drivers += ['v4l2']
endif
endif
if drivers.length() == 0 or drivers == ['auto']
error('You must enable at least one driver.')
else
message('Building with drivers ' + ', '.join(drivers))
endif
if udev.found()
add_project_arguments('-DXRT_HAVE_LIBUDEV', language: ['c', 'cpp'])
endif
if libusb.found()
add_project_arguments('-DXRT_HAVE_LIBUSB', language: ['c', 'cpp'])
endif
if opencv.found()
add_project_arguments('-DXRT_HAVE_OPENCV', language: ['c', 'cpp'])
endif
if libjpeg.found()
add_project_arguments('-DXRT_HAVE_JPEG', language: ['c', 'cpp'])
endif
if libuvc.found()
add_project_arguments('-DXRT_HAVE_LIBUVC', language: ['c', 'cpp'])
endif
if avcodec.found()
add_project_arguments('-DXRT_HAVE_FFMPEG', language: ['c', 'cpp'])
endif
if sdl2.found()
add_project_arguments('-DXRT_HAVE_SDL2', language: ['c', 'cpp'])
endif
subdir('src')
if doxygen.found()
subdir('doc')
endif
# This is here so that it gets emitted in the top-level build directory
manifest_devconf = configuration_data()
# https://github.com/mesonbuild/meson/issues/5940
manifest_devconf.set('runtime_path', openxr.full_path())
manifest_dev_json = configure_file(
input: manifest_in,
output: 'openxr_monado-dev.json',
configuration: manifest_devconf,
)

43
meson_options.txt Normal file
View file

@ -0,0 +1,43 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
option('drivers',
type: 'array',
choices: ['auto', 'hdk', 'hydra', 'ohmd', 'psmv', 'psvr', 'v4l2'],
value: ['auto'],
description: 'Set of drivers to build')
option('docs',
type: 'feature',
value: 'auto',
description: 'Build the documentation')
option('doxygen-warn-undocumented',
type: 'boolean',
value: false,
description: 'Configure doxygen to emit warnings for undocumented entities')
option('doxygen-extract-all',
type: 'boolean',
value: false,
description: 'Extract all entities for documentation, not just documented ones')
option('gui',
type: 'feature',
value: 'auto',
description: 'Enable GUI')
option('tracking',
type: 'feature',
value: 'auto',
description: 'Enable tracking support')
option('vulkan-validation',
type: 'boolean',
value: true,
description: 'Enable Vulkan validation for compositor')
option('install-active-runtime',
type: 'boolean',
value: true,
description: 'Make Monado the default OpenXR runtime on install')

View file

@ -1,4 +1,7 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
configure_file(targets_enabled_drivers.h.cmake_in ${CMAKE_CURRENT_BINARY_DIR}/targets_enabled_drivers.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(xrt)

1
src/external/meson.build vendored Normal file
View file

@ -0,0 +1 @@
external_include = include_directories('.')

22
src/meson.build Normal file
View file

@ -0,0 +1,22 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
conf_data = configuration_data()
conf_data.set('XRT_BUILD_OHMD', 'ohmd' in drivers)
conf_data.set('XRT_BUILD_HDK', 'hdk' in drivers)
conf_data.set('XRT_BUILD_PSMV', 'psmv' in drivers)
conf_data.set('XRT_BUILD_PSVR', 'psvr' in drivers)
targets_enabled_h = configure_file(
input: 'targets_enabled_drivers.h.meson_in',
output: 'targets_enabled_drivers.h',
configuration: conf_data,
)
targets_enabled = declare_dependency(
sources: targets_enabled_h,
include_directories: include_directories('.'),
)
subdir('external')
subdir('xrt')

View file

@ -0,0 +1,16 @@
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Generated header listing the drivers available
*/
#pragma once
#mesondefine XRT_BUILD_OHMD
#mesondefine XRT_BUILD_HDK
#mesondefine XRT_BUILD_PSMV
#mesondefine XRT_BUILD_PSVR

View file

@ -0,0 +1,113 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
aux_include = include_directories('.')
lib_aux_util = static_library(
'aux_util',
files(
'util/u_misc.c',
'util/u_misc.h',
'util/u_debug.c',
'util/u_debug.h',
'util/u_device.c',
'util/u_device.h',
'util/u_documentation.h',
'util/u_format.c',
'util/u_format.h',
'util/u_frame.c',
'util/u_frame.h',
'util/u_hashmap.cpp',
'util/u_hashmap.h',
'util/u_hashset.cpp',
'util/u_hashset.h',
'util/u_sink.h',
'util/u_sink_converter.c',
'util/u_sink_queue.c',
'util/u_sink_split.c',
'util/u_time.cpp',
'util/u_time.h',
'util/u_var.cpp',
'util/u_var.h',
),
include_directories: xrt_include,
)
aux_util = declare_dependency(
include_directories: aux_include,
link_whole: lib_aux_util,
)
lib_aux_os = static_library(
'aux_os',
files(
'os/os_documentation.h',
'os/os_hid.h',
'os/os_hid_hidraw.c',
'os/os_threading.h',
'os/os_time.h',
),
include_directories: xrt_include,
)
aux_os = declare_dependency(
include_directories: aux_include,
link_whole: lib_aux_os,
)
lib_aux_math = static_library(
'aux_math',
files(
'math/m_api.h',
'math/m_base.cpp',
'math/m_eigen_interop.h',
'math/m_hash.cpp',
'math/m_optics.c',
'math/m_quatexpmap.cpp',
),
include_directories: xrt_include,
dependencies: [eigen3],
)
aux_math = declare_dependency(
include_directories: aux_include,
link_whole: lib_aux_math,
)
tracking_srcs = [
'tracking/t_calibration.cpp',
'tracking/t_convert.cpp',
'tracking/t_debug_hsv_filter.cpp',
'tracking/t_debug_hsv_picker.cpp',
'tracking/t_debug_hsv_viewer.cpp',
'tracking/t_hsv_filter.c',
'tracking/t_tracking.h',
]
if 'psmv' in drivers
tracking_srcs += ['tracking/t_tracker_psmv.cpp']
endif
if 'psvr' in drivers
tracking_srcs += ['tracking/t_tracker_psvr.cpp']
endif
lib_aux_tracking = static_library(
'aux_tracking',
files(tracking_srcs),
include_directories: xrt_include,
dependencies: [eigen3, opencv],
build_by_default: build_tracking,
)
aux_tracking = declare_dependency(
include_directories: aux_include,
link_whole: lib_aux_tracking,
)
all_aux = [aux_util, aux_os, aux_math]
if build_tracking
all_aux += [aux_tracking]
endif
aux = declare_dependency(dependencies: all_aux)

View file

@ -0,0 +1,73 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
subdir('shaders')
compositor_deps = [aux, shaders, vulkan]
compositor_srcs = [
'client/comp_gl_api.c',
'client/comp_gl_api.h',
'client/comp_gl_client.c',
'client/comp_gl_client.h',
'client/comp_vk_client.c',
'client/comp_vk_client.h',
'client/comp_xlib_client.c',
'common/comp_vk.c',
'common/comp_vk.h',
'common/comp_vk_swapchain.h',
'common/comp_vk_swapchain.c',
'main/comp_client_interface.h',
'main/comp_compositor.c',
'main/comp_compositor.h',
'main/comp_distortion.c',
'main/comp_distortion.h',
'main/comp_documentation.h',
'main/comp_glue_gl.c',
'main/comp_glue_vk.c',
'main/comp_glue_xlib.c',
'main/comp_renderer.c',
'main/comp_renderer.h',
'main/comp_settings.c',
'main/comp_settings.h',
'main/comp_swapchain.c',
'main/comp_window.h',
]
compile_args = []
if xcb.found()
compile_args += ['-DVK_USE_PLATFORM_XCB_KHR']
compositor_srcs += ['main/comp_window_xcb.cpp']
compositor_deps += [xcb]
endif
if xcb_randr.found()
# TODO: monado doesn't compile when xcb is present but not xrandr
compile_args += ['-DVK_USE_PLATFORM_XLIB_XRANDR_EXT']
compositor_srcs += ['main/comp_window_direct_mode.cpp']
compositor_deps += [xcb_randr]
endif
# TODO: This backend is straight-up broken
#if wayland.found()
# compile_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR']
# compositor_srcs += ['main/comp_window_wayland.cpp']
# compositor_deps += [wayland]
#endif
if get_option('vulkan-validation')
compile_args += ['-DXRT_ENABLE_VK_VALIDATION']
endif
lib_comp = static_library(
'comp',
compositor_srcs,
include_directories: [
xrt_include,
external_include,
],
dependencies: compositor_deps,
c_args: compile_args,
cpp_args: compile_args,
)

View file

@ -0,0 +1,27 @@
shader_srcs = [
'distortion.vert',
'none.frag',
'panotools.frag',
'vive.frag',
]
shader_headers = []
foreach shader : shader_srcs
header_out = shader + '.h'
shader_headers += custom_target(
header_out,
command: [
glslangValidator,
'-V', '@INPUT@',
'-o', '@OUTPUT@',
'--vn', 'shaders_' + shader.underscorify(),
],
input: shader,
output: header_out,
)
endforeach
shaders = declare_dependency(
include_directories: include_directories('..'),
sources: shader_headers,
)

View file

@ -0,0 +1,76 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
drv_include = include_directories('.')
lib_drv_hdk = static_library(
'drv_hdk',
files(
'hdk/hdk_device.cpp',
'hdk/hdk_device.h',
'hdk/hdk_interface.h',
'hdk/hdk_prober.c',
),
include_directories: xrt_include,
dependencies: [aux, hidapi],
build_by_default: 'hdk' in drivers,
)
lib_drv_hydra = static_library(
'drv_hydra',
files(
'hydra/hydra_driver.c',
'hydra/hydra_interface.h',
),
include_directories: xrt_include,
dependencies: [aux],
build_by_default: 'hydra' in drivers,
)
lib_drv_ohmd = static_library(
'drv_ohmd',
files(
'ohmd/oh_device.c',
'ohmd/oh_device.h',
'ohmd/oh_interface.h',
'ohmd/oh_prober.c',
),
include_directories: xrt_include,
dependencies: [aux, openhmd],
build_by_default: 'ohmd' in drivers,
)
lib_drv_psmv = static_library(
'drv_psmv',
files(
'psmv/psmv_driver.c',
'psmv/psmv_interface.h',
),
include_directories: xrt_include,
dependencies: [aux],
build_by_default: 'psmv' in drivers,
)
lib_drv_psvr = static_library(
'drv_psvr',
files(
'psvr/psvr_device.c',
'psvr/psvr_device.h',
'psvr/psvr_interface.h',
'psvr/psvr_packet.c',
'psvr/psvr_prober.c',
),
include_directories: xrt_include,
dependencies: [aux, hidapi],
build_by_default: 'psvr' in drivers,
)
lib_drv_v4l2 = static_library(
'drv_v4l2',
files(
'v4l2/v4l2_driver.c',
),
include_directories: xrt_include,
dependencies: [aux, v4l2],
build_by_default: 'v4l2' in drivers,
)

10
src/xrt/meson.build Normal file
View file

@ -0,0 +1,10 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
xrt_include = include_directories('include')
subdir('auxiliary')
subdir('drivers')
subdir('compositor')
subdir('state_trackers')
subdir('targets')

View file

@ -0,0 +1,5 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
subdir('oxr')
subdir('prober')

View file

@ -0,0 +1,45 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
lib_st_oxr = static_library(
'st_oxr',
files(
'oxr_api_action.c',
'oxr_api_funcs.h',
'oxr_api_instance.c',
'oxr_api_negotiate.c',
'oxr_api_session.c',
'oxr_api_space.c',
'oxr_api_swapchain.c',
'oxr_api_system.c',
'oxr_api_verify.h',
'oxr_binding.c',
'oxr_chain.h',
'oxr_event.cpp',
'oxr_extension_support.h',
'oxr_handle_base.c',
'oxr_input.c',
'oxr_instance.c',
'oxr_logger.cpp',
'oxr_logger.h',
'oxr_objects.h',
'oxr_path.c',
'oxr_session.c',
'oxr_session_gl.c',
'oxr_session_vk.c',
'oxr_space.c',
'oxr_swapchain.c',
'oxr_swapchain_gl.c',
'oxr_swapchain_vk.c',
'oxr_system.c',
'oxr_two_call.h',
'oxr_verify.cpp',
'oxr_vulkan.c',
'oxr_xdev.c',
),
include_directories: [
xrt_include,
external_include,
],
dependencies: [aux, vulkan],
)

View file

@ -0,0 +1,42 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
prober_sources = [
'p_documentation.h',
'p_dump.c',
'p_prober.c',
'p_prober.h',
'p_tracking.c',
]
prober_deps = [aux, targets_enabled]
if udev.found()
prober_sources += ['p_udev.c']
prober_deps += [udev]
endif
if libusb.found()
prober_sources += ['p_libusb.c']
prober_deps += [libusb]
endif
if libuvc.found()
prober_sources += ['p_libuvc.c']
prober_deps += [libuvc]
endif
if v4l2.found()
prober_deps += [v4l2]
endif
lib_st_prober = static_library(
'st_prober',
files(prober_sources),
include_directories: [
xrt_include,
drv_include,
external_include,
],
dependencies: prober_deps,
)

View file

@ -11,7 +11,8 @@
#include "xrt/xrt_frameserver.h"
#include "xrt/xrt_tracking.h"
#ifdef XRT_HAVE_OPENCV
#include "targets_enabled_drivers.h"
#ifdef XRT_BUILD_PSMV
#include "tracking/t_tracking.h"
#endif
@ -43,7 +44,7 @@ struct p_factory
//! For destruction of the node graph.
struct xrt_frame_context xfctx;
#ifdef XRT_HAVE_OPENCV
#if defined(XRT_BUILD_PSMV) && defined(XRT_BUILD_PSVR)
//! Keep track of how many psmv trackers that has been handed out.
size_t num_xtmv;
@ -74,7 +75,7 @@ p_factory(struct xrt_tracking_factory *xfact)
return (struct p_factory *)xfact;
}
#ifdef XRT_HAVE_OPENCV
#if defined(XRT_BUILD_PSMV) && defined(XRT_BUILD_PSVR)
static void
on_video_device(struct xrt_prober *xp,
struct xrt_prober_device *pdev,
@ -153,7 +154,7 @@ p_factory_create_tracked_psmv(struct xrt_tracking_factory *xfact,
struct xrt_device *xdev,
struct xrt_tracked_psmv **out_xtmv)
{
#ifdef XRT_HAVE_OPENCV
#if defined(XRT_BUILD_PSMV) && defined(XRT_BUILD_PSVR)
struct p_factory *fact = p_factory(xfact);
struct xrt_tracked_psmv *xtmv = NULL;
@ -181,7 +182,7 @@ p_factory_create_tracked_psvr(struct xrt_tracking_factory *xfact,
struct xrt_device *xdev,
struct xrt_tracked_psvr **out_xtvr)
{
#ifdef XRT_HAVE_OPENCV
#if defined(XRT_BUILD_PSMV) && defined(XRT_BUILD_PSVR)
struct p_factory *fact = p_factory(xfact);
struct xrt_tracked_psvr *xtvr = NULL;
@ -241,7 +242,7 @@ p_tracking_teardown(struct prober *p)
// Drop any references to objects in the node graph.
fact->xfs = NULL;
#ifdef XRT_HAVE_OPENCV
#if defined(XRT_BUILD_PSMV) && defined(XRT_BUILD_PSVR)
fact->xtmv[0] = NULL;
fact->xtmv[1] = NULL;
#endif

View file

@ -56,9 +56,6 @@ if(BUILD_TRACKING)
list(APPEND DRIVER_LIBRARIES ${OpenCV_LIBRARIES})
endif()
configure_file(targets_enabled_drivers.h.cmake_in ${CMAKE_CURRENT_BINARY_DIR}/targets_enabled_drivers.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(common)
add_subdirectory(openxr)
add_subdirectory(cli)

View file

@ -0,0 +1,32 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
cli = executable(
'monado-cli',
files(
'cli_cmd_calibrate.c',
'cli_cmd_test.c',
'cli_common.h',
'cli_main.c',
'cli_prober.c',
),
link_whole: [
lib_aux_os,
lib_aux_util,
lib_aux_math,
lib_st_prober,
lib_target_lists,
] + driver_libs,
include_directories: [
aux_include,
common_include,
drv_include,
xrt_include,
],
dependencies: [
libusb,
libuvc,
pthreads,
udev,
] + driver_deps,
)

View file

@ -0,0 +1,13 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
common_include = include_directories('.')
lib_target_lists = static_library(
'target_lists',
files(
'target_lists.c',
),
include_directories: [drv_include, xrt_include],
dependencies: [aux, targets_enabled],
)

View file

@ -0,0 +1,65 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
gui_deps = [
libusb,
libuvc,
pthreads,
sdl2,
udev,
]
if libjpeg.found()
gui_deps += [libjpeg]
endif
gui = executable(
'monado-gui',
files(
'gui_common.h',
'gui_imgui.c',
'gui_imgui.h',
'gui_main.c',
'gui_ogl.c',
'gui_prober.c',
'gui_scene_calibrate.c',
'gui_scene.cpp',
'gui_scene_debug.c',
'gui_scene_main_menu.c',
'gui_scene_video.c',
'gui_sdl2.c',
'../../../external/glad/gl.h',
'../../../external/glad/gl.c',
'../../../external/imgui/cimgui.cpp',
'../../../external/imgui/cimgui.h',
'../../../external/imgui/imconfig.h',
'../../../external/imgui/imgui.cpp',
'../../../external/imgui/imgui.h',
'../../../external/imgui/imgui_demo.cpp',
'../../../external/imgui/imgui_draw.cpp',
'../../../external/imgui/imgui_impl_opengl3.cpp',
'../../../external/imgui/imgui_impl_opengl3.h',
'../../../external/imgui/imgui_impl_sdl.cpp',
'../../../external/imgui/imgui_impl_sdl.h',
'../../../external/imgui/imgui_internal.h',
'../../../external/imgui/imgui_widgets.cpp',
'../../../external/imgui/imstb_rectpack.h',
'../../../external/imgui/imstb_textedit.h',
'../../../external/imgui/imstb_truetype.h',
),
link_whole: [
lib_aux_os,
lib_aux_util,
lib_aux_math,
lib_st_prober,
lib_target_lists,
] + driver_libs,
include_directories: [
aux_include,
common_include,
external_include,
drv_include,
xrt_include,
],
dependencies: gui_deps + driver_deps,
)

View file

@ -0,0 +1,46 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
driver_libs = []
driver_deps = []
if libusb.found()
driver_deps += [libusb]
endif
if libjpeg.found()
driver_deps += [libjpeg]
endif
if 'hdk' in drivers
driver_libs += [lib_drv_hdk]
endif
if 'hydra' in drivers
driver_libs += [lib_drv_hydra]
endif
if 'ohmd' in drivers
driver_libs += [lib_drv_ohmd]
endif
if 'psmv' in drivers
driver_libs += [lib_drv_psmv]
endif
if 'psvr' in drivers
driver_libs += [lib_drv_psvr]
endif
if 'v4l2' in drivers
driver_libs += [lib_drv_v4l2]
driver_deps += [v4l2]
endif
subdir('common')
subdir('openxr')
subdir('cli')
if sdl2.found()
subdir('gui')
endif

View file

@ -0,0 +1,9 @@
#!/bin/sh -eux
sysconfdir="$DESTDIR"/"$1"
manifest="$2"
xrversion="$3"
runtime_path="$sysconfdir"/xdg/openxr/"$xrversion"/active_runtime.json
mkdir -p "$sysconfdir"/xdg/openxr/"$xrversion"
ln -s "$manifest" "$runtime_path"

View file

@ -0,0 +1,87 @@
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
######
# Create a loadable OpenXR driver.
# runtime_bare_suffix = 'xrt'
# runtime_prefix = runtime_bare_prefix + '_'
runtime_prefix = ''
runtime_bare_suffix = 'monado'
runtime_suffix = '_' + runtime_bare_suffix
runtime_target = '@0@openxr@1@'.format(runtime_prefix, runtime_suffix)
# OpenXR 1.0
xr_api_major = 1
openxr = library(
runtime_target,
files('target.c'),
link_whole: [
lib_aux_os,
lib_aux_util,
lib_aux_math,
lib_comp,
lib_st_oxr,
lib_st_prober,
lib_target_lists,
] + driver_libs,
include_directories: [
aux_include,
common_include,
drv_include,
xrt_include,
],
dependencies: [
libusb,
libuvc,
opengl,
pthreads,
targets_enabled,
udev,
vulkan,
x11,
xcb,
xcb_randr,
] + driver_deps,
install: true,
)
manifest_in = files('openxr_monado.meson.in.json')
manifest_conf = configuration_data()
# https://github.com/mesonbuild/meson/issues/5941
sopath = join_paths(get_option('prefix'),
get_option('libdir'), 'libopenxr_monado.so')
manifest_conf.set('runtime_path', sopath)
manifest_path = join_paths(
get_option('prefix'), get_option('datadir'), xr_api_major.to_string())
# configure_file(install: ...) was added in meson 0.50
# TODO: drop the version check once 0.50 is more widely adopted (i.e. Debian)
# https://repology.org/badge/vertical-allrepos/meson.svg?minversion=0.50.0
meson_version = meson.version().split('.')
if meson_version[1].to_int() < 50
manifest_json = configure_file(
input: manifest_in,
output: 'openxr_monado.json',
configuration: manifest_conf,
)
install_data([manifest_json], install_dir: manifest_path)
else
manifest_json = configure_file(
input: manifest_in,
output: 'openxr_monado.json',
configuration: manifest_conf,
install: true,
install_dir: manifest_path,
)
endif
meson.add_install_script('install_active_runtime.sh', get_option('sysconfdir'),
join_paths(manifest_path, runtime_target + '.json'), xr_api_major.to_string())

View file

@ -0,0 +1,6 @@
{
"file_format_version": "1.0.0",
"runtime": {
"library_path": "@runtime_path@"
}
}