mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
build: Adjust meson build equivalently
This commit is contained in:
parent
066f57d7d8
commit
871395d5b5
46
meson.build
46
meson.build
|
@ -57,16 +57,16 @@ glslangValidator = find_program('glslangValidator')
|
|||
pthreads = cc.find_library('pthread', required: true)
|
||||
|
||||
avcodec = dependency('libavcodec', required: false)
|
||||
egl = dependency('egl')
|
||||
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')
|
||||
opengl = dependency('gl', required: get_option('opengl'))
|
||||
sdl2 = dependency('sdl2', required: get_option('gui'))
|
||||
udev = dependency('libudev', required: false)
|
||||
libuvc = dependency('libuvc', required: false)
|
||||
vulkan = dependency('vulkan')
|
||||
vulkan = dependency('vulkan', required: true)
|
||||
zlib = dependency('zlib', required: false)
|
||||
|
||||
opencv = dependency('opencv4', required: false)
|
||||
|
@ -79,13 +79,13 @@ if get_option('tracking').enabled() or get_option('tracking').auto()
|
|||
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)
|
||||
x11 = dependency('x11', required: get_option('xlib'))
|
||||
xcb = dependency('xcb', required: get_option('xcb'))
|
||||
xcb_randr = dependency('xcb-randr', required: get_option('xcb'))
|
||||
|
||||
wayland = dependency('wayland-client', required: false)
|
||||
wayland_protos = dependency('wayland-protocols', required: false)
|
||||
wayland_scanner = dependency('wayland-scanner', required: false)
|
||||
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'))
|
||||
|
||||
if wayland_scanner.found()
|
||||
wayland_scanner = find_program(
|
||||
|
@ -94,6 +94,34 @@ if wayland_scanner.found()
|
|||
)
|
||||
endif
|
||||
|
||||
build_opengl = false
|
||||
if get_option('opengl').enabled() or get_option('opengl').auto()
|
||||
build_opengl = opengl.found()
|
||||
endif
|
||||
|
||||
|
||||
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
|
||||
|
||||
build_xcb_xrandr_direct = build_xcb and build_xlib and xcb_randr.found()
|
||||
|
||||
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
|
||||
|
||||
# For now required on Linux
|
||||
if target_machine.system() == 'linux'
|
||||
v4l2_required = true
|
||||
|
|
|
@ -41,3 +41,28 @@ option('install-active-runtime',
|
|||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Make Monado the default OpenXR runtime on install')
|
||||
|
||||
option('opengl',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable OpenGL/GLES application support.')
|
||||
|
||||
option('egl',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable EGL application support.')
|
||||
|
||||
option('xlib',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable xlib application support. Also required for direct mode on X.')
|
||||
|
||||
option('xcb',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable xcb support for direct mode on X.')
|
||||
|
||||
option('wayland',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable support for Wayland rendering.')
|
||||
|
|
|
@ -7,11 +7,8 @@ subdir('shaders')
|
|||
compositor_deps = [aux, shaders, vulkan]
|
||||
|
||||
compositor_srcs = [
|
||||
'client/comp_gl_client.c',
|
||||
'client/comp_gl_client.h',
|
||||
'client/comp_vk_client.c',
|
||||
'client/comp_vk_client.h',
|
||||
'client/comp_gl_xlib_client.c',
|
||||
'common/comp_vk.c',
|
||||
'common/comp_vk.h',
|
||||
'common/comp_vk_swapchain.h',
|
||||
|
@ -22,10 +19,6 @@ compositor_srcs = [
|
|||
'main/comp_distortion.c',
|
||||
'main/comp_distortion.h',
|
||||
'main/comp_documentation.h',
|
||||
'main/comp_glue_egl.c',
|
||||
'main/comp_glue_gl.c',
|
||||
'main/comp_glue_gles.c',
|
||||
'main/comp_glue_gl_xlib.c',
|
||||
'main/comp_glue_vk.c',
|
||||
'main/comp_renderer.c',
|
||||
'main/comp_renderer.h',
|
||||
|
@ -37,20 +30,44 @@ compositor_srcs = [
|
|||
|
||||
compile_args = []
|
||||
|
||||
if xcb.found()
|
||||
if build_xcb
|
||||
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
|
||||
if build_xcb_xrandr_direct
|
||||
compile_args += ['-DVK_USE_PLATFORM_XLIB_XRANDR_EXT']
|
||||
compositor_srcs += ['main/comp_window_direct_mode.cpp']
|
||||
compositor_deps += [xcb_randr]
|
||||
endif
|
||||
|
||||
if wayland.found() and wayland_protos.found() and wayland_scanner.found()
|
||||
if build_opengl
|
||||
compositor_srcs += [
|
||||
'client/comp_gl_client.c',
|
||||
'client/comp_gl_client.h',
|
||||
'main/comp_glue_gl.c',
|
||||
'main/comp_glue_gles.c',
|
||||
]
|
||||
compositor_deps += [opengl]
|
||||
endif
|
||||
|
||||
if build_opengl and build_xlib
|
||||
compositor_srcs += [
|
||||
'client/comp_gl_xlib_client.c',
|
||||
'main/comp_glue_gl_xlib.c',
|
||||
]
|
||||
compositor_deps += [x11]
|
||||
endif
|
||||
|
||||
if build_egl
|
||||
compositor_srcs += [
|
||||
'main/comp_glue_egl.c',
|
||||
]
|
||||
compositor_deps += [egl]
|
||||
endif
|
||||
|
||||
if build_wayland
|
||||
wl_protos_src = []
|
||||
wl_protos_headers = []
|
||||
wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
compile_args = []
|
||||
if x11.found()
|
||||
if build_opengl
|
||||
compile_args += ['-DXR_USE_GRAPHICS_API_OPENGL', '-DXR_USE_GRAPHICS_API_OPENGL_ES']
|
||||
endif
|
||||
|
||||
if egl.found()
|
||||
if build_egl
|
||||
compile_args += ['-DXR_USE_PLATFORM_EGL']
|
||||
endif
|
||||
|
||||
if opengl.found()
|
||||
if build_xlib
|
||||
compile_args += ['-DXR_USE_PLATFORM_XLIB']
|
||||
endif
|
||||
|
||||
|
|
|
@ -37,6 +37,31 @@ else
|
|||
hack_src += 'oxr_sdl2_hack.c'
|
||||
endif
|
||||
|
||||
openxr_deps = [
|
||||
libusb,
|
||||
libuvc,
|
||||
pthreads,
|
||||
targets_enabled,
|
||||
udev,
|
||||
vulkan,
|
||||
]
|
||||
|
||||
if build_opengl
|
||||
openxr_deps += [opengl]
|
||||
endif
|
||||
|
||||
if build_opengl and build_xlib
|
||||
openxr_deps += [x11]
|
||||
endif
|
||||
|
||||
if build_xcb
|
||||
openxr_deps += [xcb]
|
||||
endif
|
||||
|
||||
if build_xcb_xrandr_direct
|
||||
openxr_deps += [xcb_randr]
|
||||
endif
|
||||
|
||||
openxr = library(
|
||||
runtime_target,
|
||||
files(
|
||||
|
@ -61,18 +86,7 @@ openxr = library(
|
|||
drv_include,
|
||||
xrt_include,
|
||||
] + hack_incs,
|
||||
dependencies: [
|
||||
libusb,
|
||||
libuvc,
|
||||
opengl,
|
||||
pthreads,
|
||||
targets_enabled,
|
||||
udev,
|
||||
vulkan,
|
||||
x11,
|
||||
xcb,
|
||||
xcb_randr,
|
||||
] + driver_deps + hack_deps,
|
||||
dependencies: openxr_deps + driver_deps + hack_deps,
|
||||
install: true,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue