From 182d3771dde2ac59ae49881a08e0419c1e2bf6ca Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 14 Dec 2018 19:11:51 +0200 Subject: [PATCH] meson: fix pangocairo being optional Cannot use dependency() directly in the structure, because it will execute regardless of the option. Instead, let's store the dependency name in the structure and use the same logic as with simple_clients to conditionally look for the dependencies. As a bonus, this brings friendly error messages to demo-clients dependencies. subsurfaces' dependencies are also converted to maintain consistency with simple_clients. Signed-off-by: Pekka Paalanen --- clients/meson.build | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/clients/meson.build b/clients/meson.build index 062050ae..ad4eac38 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -235,7 +235,7 @@ demo_clients = [ text_input_unstable_v1_client_protocol_h, text_input_unstable_v1_protocol_c, ], - 'add_deps': [ dependency('pangocairo') ] + 'deps': [ 'pangocairo' ] }, { 'basename': 'eventdemo' }, { 'basename': 'flower' }, @@ -267,7 +267,7 @@ demo_clients = [ { 'basename': 'stacking' }, { 'basename': 'subsurfaces', - 'add_deps': [ dep_egl, dep_glesv2, dep_wl_egl ] + 'deps': [ 'egl', 'glesv2', 'wayland-egl' ] }, { 'basename': 'transformed' }, ] @@ -276,7 +276,14 @@ if get_option('demo-clients') foreach t : demo_clients t_name = 'weston-' + t.get('basename') t_srcs = [ t.get('basename') + '.c' ] + t.get('add_sources', []) - t_deps = [ dep_toytoolkit ] + t.get('add_deps', []) + t_deps = [ dep_toytoolkit ] + foreach depname : t.get('deps', []) + dep = dependency(depname, required: false) + if not dep.found() + error('@0@ requires \'@1@\' which was not found. If you rather not build this, set \'-Ddemo-clients=false\'.'.format(t_name, depname)) + endif + t_deps += dep + endforeach executable( t_name, t_srcs,