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
|
# examples
# input: glibmm_dep, giomm_dep, build_examples, compile_schemas_py
examples = [
# [[dir-name], exe-name, [sources], giomm-example (not just glibmm-example)]
[['compose'], 'example', ['main.cc'], false],
[['dbus'], 'session_bus_service', ['session_bus_service.cc'], true],
[['dbus'], 'server_without_bus', ['server_without_bus.cc'], true],
[['dbus'], 'client_bus_listnames', ['client_bus_listnames.cc'], true],
[['keyfile'], 'example', ['main.cc'], false],
[['markup'], 'parser', ['parser.cc'], false],
[['network'], 'resolver', ['resolver.cc'], true],
[['network'], 'socket-client', ['socket-client.cc'], true],
[['network'], 'socket-server', ['socket-server.cc'], true],
[['options'], 'example', ['main.cc'], false],
[['properties'], 'example', ['properties_example.cc'], false],
[['regex'], 'example', ['main.cc'], false],
[['settings'], 'settings', ['settings.cc', 'org.gtkmm.demo.gschema.xml'], true],
[['thread'], 'dispatcher', ['dispatcher.cc'], false],
[['thread'], 'dispatcher2', ['dispatcher2.cc'], false],
]
if not is_host_windows
examples += [
[['child_watch'], 'child_watch', ['main.cc'], false],
[['iochannel_stream'], 'example', ['fdstream.cc', 'main.cc'], false],
]
endif
# import('gnome').compile_schemas() can't be use here.
# It can only compile schemas in the current directory.
glib_compile_schemas = find_program('glib-compile-schemas', required: false)
foreach ex : examples
dir = ''
foreach dir_part : ex[0]
dir = dir / dir_part
endforeach
ex_name = (dir / ex[1]).underscorify()
ex_sources = []
foreach src : ex[2]
if src.endswith('.gschema.xml')
if glib_compile_schemas.found()
custom_target(dir.underscorify() + '_schemas',
input: dir / src,
output: dir.underscorify() + '_gschemas.compiled',
command: [
python3, compile_schemas_py,
meson.current_source_dir() / dir,
meson.current_build_dir() / dir,
'@OUTPUT@'
],
build_by_default: build_examples,
install: false,
)
endif
else
ex_sources += dir / src
endif
endforeach
executable(ex_name, ex_sources,
cpp_args: ['-DGLIBMM_DISABLE_DEPRECATED', '-DGIOMM_DISABLE_DEPRECATED'],
dependencies: ex[3] ? giomm_dep : glibmm_dep,
gui_app: false,
build_by_default: build_examples,
install: false,
)
endforeach
|