parent
bc9444e1e0
commit
2ecd2ea65a
8 changed files with 129 additions and 0 deletions
@ -0,0 +1 @@ |
||||
This is a text only input file. |
@ -0,0 +1 @@ |
||||
subdir/data.dat |
@ -0,0 +1,14 @@ |
||||
project('custom target', 'c') |
||||
|
||||
python = find_program('python3') |
||||
|
||||
comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') |
||||
infile = '@0@/@1@'.format(meson.current_source_dir(), 'data_source.txt') |
||||
outfile = '@0@/@1@'.format(meson.current_build_dir(), 'data.dat') |
||||
|
||||
mytarget = custom_target('bindat', |
||||
output : 'data.dat', |
||||
command : [python, comp, infile, outfile], |
||||
install : true, |
||||
install_dir : 'subdir' |
||||
) |
@ -0,0 +1,14 @@ |
||||
#!/usr/bin/python3 |
||||
|
||||
import sys |
||||
|
||||
if __name__ == '__main__': |
||||
if len(sys.argv) != 3: |
||||
print(sys.argv[0], 'input_file output_file') |
||||
sys.exit(1) |
||||
ifile = open(sys.argv[1]).read() |
||||
if ifile != 'This is a text only input file.\n': |
||||
print('Malformed input') |
||||
sys.exit(1) |
||||
ofile = open(sys.argv[2], 'w') |
||||
ofile.write('This is a binary output file.\n') |
Loading…
Reference in new issue