| 1 |
# examples/book/giomm |
| 2 |
|
| 3 |
# input: gnome, giomm_dep, build_examples_by_default, copy_to_subdir, |
| 4 |
# meson_backend, project_build_root, python3 |
| 5 |
# input and output: examples_targets |
| 6 |
|
| 7 |
examples_book_giomm = [ |
| 8 |
# [[dir-name], exe-name, [sources]] |
| 9 |
[['directory_list'], 'example', ['main.cc']], |
| 10 |
[['getline'], 'example', ['getline.cc']], |
| 11 |
[['monitor_directory'], 'monitor_directory', ['monitor_directory.cc']], |
| 12 |
[['read_file'], 'example', ['main.cc']], |
| 13 |
[['read_file_async'], 'example', ['main.cc']], |
| 14 |
[['usage'], 'usage', ['usage.cc']], |
| 15 |
[['volumes'], 'example', ['main.cc']], |
| 16 |
[['write_file'], 'example', ['main.cc']], |
| 17 |
] |
| 18 |
|
| 19 |
foreach ex : examples_book_giomm |
| 20 |
dir = '' |
| 21 |
foreach dir_part : ex[0] |
| 22 |
dir = dir / dir_part |
| 23 |
endforeach |
| 24 |
ex_name = (dir / ex[1]).underscorify() |
| 25 |
ex_sources = [] |
| 26 |
resources = [] |
| 27 |
foreach src : ex[2] |
| 28 |
if src.endswith('.gresource.xml') |
| 29 |
resources = gnome.compile_resources(dir.underscorify() + '_resources', |
| 30 |
dir / src, |
| 31 |
source_dir: dir, |
| 32 |
install: false, |
| 33 |
) |
| 34 |
else |
| 35 |
ex_sources += dir / src |
| 36 |
endif |
| 37 |
endforeach |
| 38 |
|
| 39 |
exe_file = executable(ex_name, ex_sources, resources, |
| 40 |
dependencies: giomm_dep, |
| 41 |
win_subsystem: 'console', |
| 42 |
build_by_default: build_examples_by_default, |
| 43 |
install: false, |
| 44 |
) |
| 45 |
|
| 46 |
stamp_file_name = ex_name + '_copy.stamp' |
| 47 |
examples_targets += custom_target(stamp_file_name, |
| 48 |
input: exe_file, |
| 49 |
output: stamp_file_name, |
| 50 |
command: [ |
| 51 |
python3, copy_to_subdir, |
| 52 |
'@INPUT@', |
| 53 |
dir, |
| 54 |
ex[1], |
| 55 |
'@OUTPUT@', |
| 56 |
], |
| 57 |
build_by_default: build_examples_by_default, |
| 58 |
install: false, |
| 59 |
) |
| 60 |
|
| 61 |
# These example programs build quite fast. No need for extra timeout time. |
| 62 |
target_name = 'examples' / 'book' / 'giomm' / stamp_file_name |
| 63 |
test('book_giomm_' + ex_name, meson_backend, |
| 64 |
args: target_name, |
| 65 |
workdir: project_build_root |
| 66 |
) |
| 67 |
endforeach |