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 <pq@iki.fi>
This commit is contained in:
Pekka Paalanen 2018-12-14 19:11:51 +02:00
parent a23ce29506
commit 182d3771dd

View File

@ -235,7 +235,7 @@ demo_clients = [
text_input_unstable_v1_client_protocol_h, text_input_unstable_v1_client_protocol_h,
text_input_unstable_v1_protocol_c, text_input_unstable_v1_protocol_c,
], ],
'add_deps': [ dependency('pangocairo') ] 'deps': [ 'pangocairo' ]
}, },
{ 'basename': 'eventdemo' }, { 'basename': 'eventdemo' },
{ 'basename': 'flower' }, { 'basename': 'flower' },
@ -267,7 +267,7 @@ demo_clients = [
{ 'basename': 'stacking' }, { 'basename': 'stacking' },
{ {
'basename': 'subsurfaces', 'basename': 'subsurfaces',
'add_deps': [ dep_egl, dep_glesv2, dep_wl_egl ] 'deps': [ 'egl', 'glesv2', 'wayland-egl' ]
}, },
{ 'basename': 'transformed' }, { 'basename': 'transformed' },
] ]
@ -276,7 +276,14 @@ if get_option('demo-clients')
foreach t : demo_clients foreach t : demo_clients
t_name = 'weston-' + t.get('basename') t_name = 'weston-' + t.get('basename')
t_srcs = [ t.get('basename') + '.c' ] + t.get('add_sources', []) 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( executable(
t_name, t_srcs, t_name, t_srcs,