build: use force_fallback_for

This allows users to more easily control how dependencies are
looked up. By default, a subproject is used, but users can pass
--force_fallback_for=[] to use system deps.
This commit is contained in:
Simon Ser 2021-07-20 18:33:51 +02:00
parent 17ba657dd6
commit cf395c765b

View file

@ -2,7 +2,7 @@ project(
'gamescope', 'gamescope',
['c','cpp'], ['c','cpp'],
meson_version: '>=0.54.0', meson_version: '>=0.54.0',
default_options: ['warning_level=2'], default_options: ['warning_level=2', 'force_fallback_for=wlroots,libliftoff'],
) )
add_project_arguments([ add_project_arguments([
@ -44,13 +44,12 @@ thread_dep = dependency('threads')
cap_dep = cc.find_library('cap') cap_dep = cc.find_library('cap')
sdl_dep = dependency('SDL2') sdl_dep = dependency('SDL2')
wlroots_proj = subproject('wlroots', required: false, default_options: wlroots_dep = dependency(
['default_library=static', 'examples=false', 'xwayland=enabled']) 'wlroots',
if wlroots_proj.found() version: ['>= 0.13.0', '< 0.14.0'],
wlroots_dep = wlroots_proj.get_variable('wlroots') fallback: ['wlroots', 'wlroots'],
else default_options: ['default_library=static', 'examples=false', 'xwayland=enabled'],
wlroots_dep = dependency('wlroots', version: ['>= 0.13.0', '< 0.14.0']) )
endif
wlroots_has_xwayland = wlroots_dep.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true' wlroots_has_xwayland = wlroots_dep.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true'
if not wlroots_has_xwayland if not wlroots_has_xwayland
@ -69,13 +68,12 @@ spirv_shader = custom_target('shader_target',
install : false, install : false,
) )
liftoff_proj = subproject('libliftoff', required: false, default_options: liftoff_dep = dependency(
['default_library=static']) 'libliftoff',
if liftoff_proj.found() version: ['>= 0.1.0', '< 0.2.0'],
liftoff_dep = liftoff_proj.get_variable('liftoff') fallback: ['libliftoff', 'liftoff'],
else default_options: ['default_library=static'],
liftoff_dep = dependency('libliftoff') )
endif
subdir('protocol') subdir('protocol')