summaryrefslogtreecommitdiffstats
path: root/test cases/common/109 custom target capture/meson.build
blob: b7622014a99d236ed2dd7071c6d199248b5914a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
project('custom target')

python3 = import('python3').find_python()

# Note that this will not add a dependency to the compiler executable.
# Code will not be rebuilt if it changes.
comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py')

mytarget = custom_target('bindat',
  output : 'data.dat',
  input : 'data_source.txt',
  capture : true,
  command : [python3, comp, '@INPUT@'],
  install : true,
  install_dir : 'subdir'
)

ct_output_exists = '''import os, sys
if not os.path.exists(sys.argv[1]):
  print("could not find {!r} in {!r}".format(sys.argv[1], os.getcwd()))
  sys.exit(1)
'''

test('capture-wrote', python3, args : ['-c', ct_output_exists, mytarget])