| 1 |
project('custom target', 'c') |
| 2 |
|
| 3 |
python = find_program('python3', required : false) |
| 4 |
if not python.found() |
| 5 |
python = find_program('python') |
| 6 |
endif |
| 7 |
|
| 8 |
# files() is the correct way to do this, but some people |
| 9 |
# do this so test that it works. |
| 10 |
comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') |
| 11 |
comp2 = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler2.py') |
| 12 |
infile = files('data_source.txt')[0] |
| 13 |
|
| 14 |
mytarget = custom_target('bindat', |
| 15 |
output : 'data.dat', |
| 16 |
command : [python, comp, infile, '@OUTPUT@'], |
| 17 |
env: {'SOME_ENV_VAR': ['garbage', ['in', 'garbage', 'out']]}, |
| 18 |
) |
| 19 |
|
| 20 |
mytarget2 = custom_target('bindat2', |
| 21 |
output : 'data2.dat', |
| 22 |
command : [python, comp2, mytarget, '@OUTPUT@'], |
| 23 |
install : true, |
| 24 |
install_dir : 'subdir' |
| 25 |
) |
| 26 |
|
| 27 |
mytarget3 = custom_target('bindat3', |
| 28 |
output : 'data3.dat', |
| 29 |
input : [mytarget], |
| 30 |
command : [python, comp2, '@INPUT@', '@OUTPUT@'], |
| 31 |
install : true, |
| 32 |
install_dir : 'subdir' |
| 33 |
) |
| 34 |
|
| 35 |
subdir('usetarget') |