Debian Codegraph @

test cases/common/140 custom target multiple outputs/meson.build

raw
1 project('multiple outputs install')
2
3 gen = find_program('generator.py')
4
5 custom_target('different-install-dirs',
6 output : ['diff.h', 'diff.sh'],
7 command : [gen, 'diff', '@OUTDIR@'],
8 install : true,
9 install_dir : [join_paths(get_option('prefix'), get_option('includedir')),
10 join_paths(get_option('prefix'), get_option('bindir'))])
11
12 custom_target('same-install-dir',
13 output : ['same.h', 'same.sh'],
14 command : [gen, 'same', '@OUTDIR@'],
15 install : true,
16 install_dir : '/opt')
17
18 custom_target('only-install-first',
19 output : ['first.h', 'first.sh'],
20 command : [gen, 'first', '@OUTDIR@'],
21 install : true,
22 install_dir : [join_paths(get_option('prefix'), get_option('includedir')), false])
23
24 targets = custom_target('only-install-second',
25 output : ['second.h', 'second.sh'],
26 command : [gen, 'second', '@OUTDIR@'],
27 install : true,
28 install_dir : [false, join_paths(get_option('prefix'), get_option('bindir'))])
29
30 paths = []
31 foreach i : targets.to_list()
32 paths += i.full_path()
33 endforeach
34
35 # The Xcode backend has a different output naming scheme.
36 if meson.backend() == 'xcode'
37 assert(paths == [meson.project_build_root() / get_option('buildtype') / 'second.h',
38 meson.project_build_root() / get_option('buildtype') / 'second.sh'])
39
40 # Skip on Windows because paths are not identical, '/' VS '\'.
41 elif host_machine.system() != 'windows'
42 assert(paths == [meson.current_build_dir() / 'second.h',
43 meson.current_build_dir() / 'second.sh'])
44 endif