2020-01-25 14:36:31 +00:00
|
|
|
# Copyright 2019-2020, Collabora, Ltd.
|
2019-09-24 13:43:43 +00:00
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
|
|
|
project(
|
|
|
|
'xrt',
|
|
|
|
['c', 'cpp'],
|
2021-01-28 15:47:56 +00:00
|
|
|
version: '21.0.0',
|
2019-09-24 13:43:43 +00:00
|
|
|
license: 'BSL-1.0',
|
|
|
|
meson_version: '>=0.49.0',
|
|
|
|
default_options: [
|
|
|
|
'c_std=c11',
|
2021-05-10 15:01:46 +00:00
|
|
|
'cpp_std=c++17',
|
2020-03-31 16:03:45 +00:00
|
|
|
'warning_level=3',
|
2019-09-24 13:43:43 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
cpp = meson.get_compiler('cpp')
|
|
|
|
|
|
|
|
add_project_arguments(cc.get_supported_arguments([
|
|
|
|
'-D_XOPEN_SOURCE=700',
|
|
|
|
'-Wno-unused-parameter',
|
2020-07-16 20:38:17 +00:00
|
|
|
'-Werror-implicit-function-declaration',
|
|
|
|
'-Werror=incompatible-pointer-types'
|
2019-09-24 13:43:43 +00:00
|
|
|
]), language: 'c')
|
|
|
|
|
|
|
|
add_project_arguments(cpp.get_supported_arguments([
|
|
|
|
'-D_XOPEN_SOURCE=700',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-deprecated-copy', # Eigen
|
2020-12-16 14:09:11 +00:00
|
|
|
'-Wno-c11-extensions' # clang OpenCV
|
2019-09-24 13:43:43 +00:00
|
|
|
]), language: 'cpp')
|
|
|
|
|
2019-11-02 22:25:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Pre-setting these variables
|
|
|
|
#
|
|
|
|
|
|
|
|
build_tracking = false
|
|
|
|
|
|
|
|
v4l2_required = false
|
|
|
|
hidapi_required = false
|
|
|
|
openhmd_required = false
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Adding dependencies
|
|
|
|
#
|
|
|
|
|
2019-11-05 09:26:02 +00:00
|
|
|
# When docs are disabled, doxygen will always appear as "not found"
|
2019-11-02 22:29:45 +00:00
|
|
|
doxygen = find_program('doxygen', required: get_option('docs'))
|
2019-11-05 09:26:02 +00:00
|
|
|
build_docs = doxygen.found()
|
2019-11-02 22:29:45 +00:00
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
glslangValidator = find_program('glslangValidator')
|
|
|
|
|
2019-11-02 22:30:28 +00:00
|
|
|
pthreads = cc.find_library('pthread', required: true)
|
2020-04-11 00:28:35 +00:00
|
|
|
rt = cc.find_library('rt', required: true)
|
2019-11-02 22:30:28 +00:00
|
|
|
|
2020-07-16 22:22:59 +00:00
|
|
|
avcodec = dependency('libavcodec', required: false)
|
|
|
|
egl = dependency('egl', required: get_option('egl'))
|
|
|
|
egl = egl.partial_dependency(includes: true)
|
|
|
|
eigen3 = dependency('eigen3')
|
|
|
|
libjpeg = dependency('libjpeg', required: false)
|
|
|
|
libusb = dependency('libusb-1.0', required: false)
|
|
|
|
opengl = dependency('gl', required: get_option('opengl'))
|
|
|
|
opengles = dependency('glesv2', required: get_option('opengles'))
|
|
|
|
rs = dependency('realsense2', required: false)
|
|
|
|
sdl2 = dependency('sdl2', required: get_option('gui'))
|
|
|
|
udev = dependency('libudev', required: false)
|
|
|
|
libuvc = dependency('libuvc', required: false)
|
|
|
|
vulkan = dependency('vulkan', required: true)
|
|
|
|
zlib = dependency('zlib', required: false)
|
|
|
|
survive = dependency('survive', required: false)
|
2020-10-04 23:07:14 +00:00
|
|
|
dbus = dependency('dbus-1', required: get_option('dbus'))
|
2020-10-14 20:52:19 +00:00
|
|
|
systemd = dependency('libsystemd', required: get_option('systemd'))
|
2020-10-21 20:18:57 +00:00
|
|
|
libbsd = dependency('libbsd', required: get_option('libbsd'))
|
2020-11-26 19:16:02 +00:00
|
|
|
gst = dependency('gstreamer-1.0', required: false)
|
|
|
|
gst_app = dependency('gstreamer-app-1.0', required: false)
|
|
|
|
gst_video= dependency('gstreamer-video-1.0', required: false)
|
2021-06-10 19:18:34 +00:00
|
|
|
depthai = dependency('depthai', method: 'cmake', modules : ['depthai::core', 'depthai::opencv', 'XLink'], required: false)
|
2020-11-26 19:16:02 +00:00
|
|
|
|
|
|
|
gst_found = gst.found() and gst_app.found() and gst_video.found()
|
2019-09-24 13:43:43 +00:00
|
|
|
|
2021-03-29 22:31:12 +00:00
|
|
|
leap = cc.find_library('Leap', dirs : ['/usr/local/lib'], required: false)
|
|
|
|
inc_leap = include_directories('/usr/local/include')
|
|
|
|
|
2019-09-29 11:22:03 +00:00
|
|
|
opencv = dependency('opencv4', required: false)
|
|
|
|
if not opencv.found()
|
|
|
|
opencv = dependency('opencv', required: get_option('tracking'))
|
|
|
|
endif
|
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
if get_option('tracking').enabled() or get_option('tracking').auto()
|
|
|
|
build_tracking = opencv.found()
|
|
|
|
endif
|
|
|
|
|
|
|
|
# TODO: make these behave well when not present
|
2020-01-14 18:21:23 +00:00
|
|
|
x11 = dependency('x11', required: get_option('xlib'))
|
2020-03-31 15:15:57 +00:00
|
|
|
x11_xcb = dependency('x11-xcb', required: get_option('xlib'))
|
2020-01-14 18:21:23 +00:00
|
|
|
xcb = dependency('xcb', required: get_option('xcb'))
|
|
|
|
xcb_randr = dependency('xcb-randr', required: get_option('xcb'))
|
2019-09-19 20:27:56 +00:00
|
|
|
|
2020-01-14 18:21:23 +00:00
|
|
|
wayland = dependency('wayland-client', required: get_option('wayland'))
|
|
|
|
wayland_protos = dependency('wayland-protocols', required: get_option('wayland'))
|
|
|
|
wayland_scanner = dependency('wayland-scanner', required: get_option('wayland'))
|
2019-09-19 20:27:56 +00:00
|
|
|
|
|
|
|
if wayland_scanner.found()
|
|
|
|
wayland_scanner = find_program(
|
|
|
|
wayland_scanner.get_pkgconfig_variable('wayland_scanner'),
|
|
|
|
native: true,
|
|
|
|
)
|
|
|
|
endif
|
2019-09-24 13:43:43 +00:00
|
|
|
|
2020-01-14 18:21:23 +00:00
|
|
|
build_opengl = false
|
|
|
|
if get_option('opengl').enabled() or get_option('opengl').auto()
|
|
|
|
build_opengl = opengl.found()
|
|
|
|
endif
|
|
|
|
|
2020-07-16 22:22:59 +00:00
|
|
|
build_opengles = false
|
|
|
|
if get_option('opengles').enabled() or get_option('opengles').auto()
|
|
|
|
build_opengles = opengles.found() and egl.found()
|
|
|
|
endif
|
|
|
|
|
2020-01-14 18:21:23 +00:00
|
|
|
|
|
|
|
build_egl = false
|
|
|
|
if get_option('egl').enabled() or get_option('egl').auto()
|
|
|
|
build_egl = opengl.found() and egl.found()
|
|
|
|
endif
|
|
|
|
|
|
|
|
build_xlib = false
|
|
|
|
if get_option('xlib').enabled() or get_option('xlib').auto()
|
|
|
|
build_xlib = x11.found()
|
|
|
|
endif
|
|
|
|
|
|
|
|
build_xcb = false
|
|
|
|
if get_option('xcb').enabled() or get_option('xcb').auto()
|
|
|
|
build_xcb = xcb.found()
|
|
|
|
endif
|
|
|
|
|
2020-03-31 15:15:57 +00:00
|
|
|
build_xcb_xrandr_direct = build_xcb and build_xlib and xcb_randr.found() and x11_xcb.found()
|
2020-01-14 18:21:23 +00:00
|
|
|
|
2021-01-15 14:24:00 +00:00
|
|
|
# requires only vulkan
|
|
|
|
build_vk_khr_display = true
|
|
|
|
|
2020-01-14 18:21:23 +00:00
|
|
|
build_wayland = false
|
|
|
|
if get_option('wayland').enabled() or get_option('wayland').auto()
|
|
|
|
build_wayland = wayland.found() and wayland_protos.found() and wayland_scanner.found()
|
|
|
|
endif
|
|
|
|
|
2019-09-26 15:13:24 +00:00
|
|
|
# For now required on Linux
|
2019-09-26 15:30:52 +00:00
|
|
|
if target_machine.system() == 'linux'
|
2019-09-26 15:13:24 +00:00
|
|
|
v4l2_required = true
|
|
|
|
endif
|
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
drivers = get_option('drivers')
|
|
|
|
if 'ohmd' in drivers
|
|
|
|
openhmd_required = true
|
|
|
|
endif
|
2019-10-31 01:26:19 +00:00
|
|
|
if 'psvr' in drivers
|
2019-09-24 13:43:43 +00:00
|
|
|
hidapi_required = true
|
|
|
|
endif
|
|
|
|
if 'v4l2' in drivers
|
|
|
|
v4l2_required = true
|
|
|
|
endif
|
|
|
|
|
|
|
|
if 'auto' in drivers
|
2020-12-04 16:43:46 +00:00
|
|
|
drivers += ['dummy', 'hdk', 'hydra', 'ns', 'psmv', 'remote', 'wmr']
|
2019-09-24 13:43:43 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
openhmd = dependency('openhmd', required: openhmd_required)
|
2019-09-26 20:51:05 +00:00
|
|
|
hidapi = dependency('hidapi-libusb', required: hidapi_required)
|
2020-08-26 20:51:49 +00:00
|
|
|
|
|
|
|
has_v4l2_header = cc.has_header('linux/v4l2-common.h')
|
2019-09-24 13:43:43 +00:00
|
|
|
|
|
|
|
if openhmd.found() and ('auto' in drivers or 'ohmd' in drivers)
|
|
|
|
if 'ohmd' not in drivers
|
|
|
|
drivers += ['ohmd']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-11-23 22:04:29 +00:00
|
|
|
if has_v4l2_header and ('auto' in drivers or 'handtracking' in drivers)
|
|
|
|
if 'handtracking' not in drivers
|
|
|
|
drivers += ['handtracking']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
if hidapi.found() and ('auto' in drivers or 'psvr' in drivers or 'hdk' in drivers)
|
|
|
|
if 'psvr' not in drivers
|
|
|
|
drivers += ['psvr']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-10-02 11:00:52 +00:00
|
|
|
if zlib.found() and ('auto' in drivers or 'vive' in drivers)
|
|
|
|
if 'vive' not in drivers
|
|
|
|
drivers += ['vive']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-02-09 15:36:36 +00:00
|
|
|
if rs.found() and ('auto' in drivers or 'rs' in drivers)
|
|
|
|
if 'rs' not in drivers
|
|
|
|
drivers += ['rs']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-08-26 20:51:49 +00:00
|
|
|
if has_v4l2_header and ('auto' in drivers or 'v4l2' in drivers)
|
2019-09-24 13:43:43 +00:00
|
|
|
if 'v4l2' not in drivers
|
|
|
|
drivers += ['v4l2']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-11-26 19:16:02 +00:00
|
|
|
if gst_found and ('auto' in drivers or 'vf' in drivers)
|
|
|
|
if 'vf' not in drivers
|
|
|
|
drivers += ['vf']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-06-10 19:18:34 +00:00
|
|
|
if depthai.found() and ('auto' in drivers or 'depthai' in drivers)
|
|
|
|
if 'depthai' not in drivers
|
|
|
|
drivers += ['depthai']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-03-29 22:31:12 +00:00
|
|
|
if leap.found() and ('auto' in drivers or 'ulv2' in drivers)
|
|
|
|
if 'ulv2' not in drivers
|
|
|
|
drivers += ['ulv2']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-12-16 15:35:00 +00:00
|
|
|
if survive.found() and ('auto' in drivers and 'survive' not in drivers)
|
|
|
|
drivers += ['survive']
|
2019-03-12 01:02:06 +00:00
|
|
|
endif
|
|
|
|
|
2020-10-04 23:07:53 +00:00
|
|
|
if not get_option('dbus').disabled() and dbus.found()
|
2021-03-01 23:34:17 +00:00
|
|
|
if 'auto' in drivers and 'daydream' not in drivers
|
2020-10-04 23:07:53 +00:00
|
|
|
drivers += ['daydream']
|
|
|
|
endif
|
|
|
|
|
2021-03-01 23:34:17 +00:00
|
|
|
if 'auto' in drivers and 'arduino' not in drivers
|
2020-10-04 23:07:53 +00:00
|
|
|
drivers += ['arduino']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-03-11 14:25:00 +00:00
|
|
|
if sdl2.found() and ('auto' in drivers and 'qwerty' not in drivers)
|
|
|
|
drivers += ['qwerty']
|
|
|
|
endif
|
|
|
|
|
2021-08-20 14:28:30 +00:00
|
|
|
if opencv.found() and ('auto' in drivers and 'euroc' not in drivers)
|
|
|
|
drivers += ['euroc']
|
|
|
|
endif
|
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
if drivers.length() == 0 or drivers == ['auto']
|
|
|
|
error('You must enable at least one driver.')
|
|
|
|
endif
|
|
|
|
|
2019-11-02 22:25:31 +00:00
|
|
|
#
|
|
|
|
# Go down sub directories
|
|
|
|
#
|
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
subdir('src')
|
|
|
|
|
2019-11-02 22:25:31 +00:00
|
|
|
if build_docs
|
2019-09-24 13:43:43 +00:00
|
|
|
subdir('doc')
|
|
|
|
endif
|
|
|
|
|
2021-01-07 21:13:14 +00:00
|
|
|
if not get_option('tests').disabled()
|
|
|
|
subdir('tests')
|
|
|
|
endif
|
2019-11-02 22:25:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Final bits
|
|
|
|
#
|
|
|
|
|
2019-09-24 13:43:43 +00:00
|
|
|
# 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,
|
|
|
|
)
|
2019-11-02 22:25:31 +00:00
|
|
|
|
|
|
|
message('Configuration done!')
|
|
|
|
message(' drivers: ' + ', '.join(drivers))
|
|
|
|
|
|
|
|
if build_docs
|
|
|
|
message(' docs: yes')
|
|
|
|
else
|
|
|
|
message(' docs: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if build_tracking
|
|
|
|
message(' tracking: yes')
|
|
|
|
else
|
|
|
|
message(' tracking: no')
|
|
|
|
endif
|
2020-06-10 13:48:43 +00:00
|
|
|
|
|
|
|
if get_option('steamvr_plugin')
|
|
|
|
message('steamvr plugin: yes')
|
|
|
|
else
|
|
|
|
message('steamvr plugin: no')
|
|
|
|
endif
|
2020-10-14 22:04:54 +00:00
|
|
|
|
|
|
|
if build_opengl
|
|
|
|
message(' opengl: yes')
|
|
|
|
else
|
|
|
|
message(' opengl: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if build_opengles
|
|
|
|
message(' opengles: yes')
|
|
|
|
else
|
|
|
|
message(' opengles: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if build_egl
|
|
|
|
message(' egl: yes')
|
|
|
|
else
|
|
|
|
message(' egl: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if build_xlib
|
|
|
|
message(' xlib: yes')
|
|
|
|
else
|
|
|
|
message(' xlib: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if build_xcb
|
|
|
|
message(' xcb: yes')
|
|
|
|
else
|
|
|
|
message(' xcb: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if build_wayland
|
|
|
|
message(' wayland: yes')
|
|
|
|
else
|
|
|
|
message(' wayland: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if not get_option('systemd').disabled() and systemd.found()
|
|
|
|
message(' systemd: yes')
|
|
|
|
else
|
|
|
|
message(' systemd: no')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if not get_option('dbus').disabled() and dbus.found()
|
|
|
|
message(' dbus: yes')
|
|
|
|
else
|
|
|
|
message(' dbus: no')
|
|
|
|
endif
|
2020-10-21 20:18:57 +00:00
|
|
|
|
|
|
|
if not get_option('libbsd').disabled() and libbsd.found()
|
|
|
|
message(' libbsd: yes')
|
|
|
|
else
|
|
|
|
message(' libbsd: no')
|
|
|
|
endif
|