aboutsummaryrefslogtreecommitdiff
path: root/examples/meson.build
blob: ac60e5f98212131caae65b912522329fc480fe2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
threads = dependency('threads')
wayland_cursor = dependency('wayland-cursor')
libpng = dependency('libpng', required: false)
# These versions correspond to ffmpeg 4.0
libavutil = dependency('libavutil', version: '>=56.14.100', required: false)
libavcodec = dependency('libavcodec', version: '>=58.18.100', required: false)
libavformat = dependency('libavformat', version: '>=58.12.100', required: false)

# Small hack until https://github.com/mesonbuild/meson/pull/3386/ is merged
foreach dep : ['libpng', 'libavutil', 'libavcodec', 'libavformat']
	if not get_variable(dep).found()
		set_variable(dep, disabler())
	endif
endforeach

if not cc.has_header('libavutil/hwcontext_drm.h', dependencies: libavutil)
	libavutil = disabler()
endif

examples = {
	'simple': {
		'src': 'simple.c',
		'dep': [wlroots],
	},
	'pointer': {
		'src': 'pointer.c',
		'dep': [wlroots],
	},
	'touch': {
		'src': ['touch.c', 'cat.c'],
		'dep': [wlroots],
	},
	'tablet': {
		'src': 'tablet.c',
		'dep': [wlroots],
	},
	'rotation': {
		'src': ['rotation.c', 'cat.c'],
		'dep': [wlroots],
	},
	'multi-pointer': {
		'src': 'multi-pointer.c',
		'dep': [wlroots],
	},
	'output-layout': {
		'src': ['output-layout.c', 'cat.c'],
		'dep': [wlroots],
	},
	'screenshot': {
		'src': 'screenshot.c',
		'dep': [wayland_client, wlr_protos, wlroots],
	},
	'idle': {
		'src': 'idle.c',
		'dep': [wayland_client, wlr_protos, wlroots, threads],
	},
	'idle-inhibit': {
		'src': 'idle-inhibit.c',
		'dep': [wayland_client, wlr_protos, wlroots],
	},
	'layer-shell': {
		'src': 'layer-shell.c',
		'dep': [wayland_client, wayland_cursor, wlr_protos, wlroots],
	},
	'input-inhibitor': {
		'src': 'input-inhibitor.c',
		'dep': [wayland_client, wayland_cursor, wlr_protos, wlroots],
	},
	'gamma-control': {
		'src': 'gamma-control.c',
		'dep': [wayland_client, wayland_cursor, wlr_protos, wlroots],
	},
	'pointer-constraints': {
		'src': 'pointer-constraints.c',
		'dep': [wayland_client, wlr_protos, wlroots],
	},
	'dmabuf-capture': {
		'src': 'dmabuf-capture.c',
		'dep': [
			libavcodec,
			libavformat,
			libavutil,
			threads,
			wayland_client,
			wlr_protos,
			wlroots,
		],
	},
	'screencopy': {
		'src': 'screencopy.c',
		'dep': [libpng, wayland_client, wlr_protos, wlroots],
	},
	'toplevel-decoration': {
		'src': 'toplevel-decoration.c',
		'dep': [wayland_client, wlr_protos, wlroots],
	},
	'text-input': {
	    'src': 'text-input.c',
	    'dep': [wayland_cursor, wayland_client, wlr_protos, wlroots],
    },
}

foreach name, info : examples
	all_dep_found = true
	foreach d : info.get('dep')
		all_dep_found = all_dep_found and d.found()
	endforeach
	if all_dep_found
		executable(
			name,
			info.get('src'),
			dependencies: info.get('dep'),
			build_by_default: get_option('examples'),
		)
	else
		warning('Dependencies not satisfied for ' + name)
	endif
endforeach