From cf395c765b143f9ece2c8f6de7209fa1d1ea831c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 20 Jul 2021 18:33:51 +0200 Subject: [PATCH] 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. --- meson.build | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build index 8c8346c..0e969b8 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'gamescope', ['c','cpp'], meson_version: '>=0.54.0', - default_options: ['warning_level=2'], + default_options: ['warning_level=2', 'force_fallback_for=wlroots,libliftoff'], ) add_project_arguments([ @@ -44,13 +44,12 @@ thread_dep = dependency('threads') cap_dep = cc.find_library('cap') sdl_dep = dependency('SDL2') -wlroots_proj = subproject('wlroots', required: false, default_options: - ['default_library=static', 'examples=false', 'xwayland=enabled']) -if wlroots_proj.found() - wlroots_dep = wlroots_proj.get_variable('wlroots') -else - wlroots_dep = dependency('wlroots', version: ['>= 0.13.0', '< 0.14.0']) -endif +wlroots_dep = dependency( + 'wlroots', + version: ['>= 0.13.0', '< 0.14.0'], + fallback: ['wlroots', 'wlroots'], + default_options: ['default_library=static', 'examples=false', 'xwayland=enabled'], +) wlroots_has_xwayland = wlroots_dep.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true' if not wlroots_has_xwayland @@ -69,13 +68,12 @@ spirv_shader = custom_target('shader_target', install : false, ) -liftoff_proj = subproject('libliftoff', required: false, default_options: - ['default_library=static']) -if liftoff_proj.found() - liftoff_dep = liftoff_proj.get_variable('liftoff') -else - liftoff_dep = dependency('libliftoff') -endif +liftoff_dep = dependency( + 'libliftoff', + version: ['>= 0.1.0', '< 0.2.0'], + fallback: ['libliftoff', 'liftoff'], + default_options: ['default_library=static'], +) subdir('protocol')