meson.build 745 B

12345678910111213141516171819202122232425
  1. project('build on all', 'c')
  2. py3_mod = import('python3')
  3. py3 = py3_mod.find_python()
  4. executable('fooprog', 'foo.c', build_by_default : false)
  5. comp = files('mygen.py')
  6. mytarget = custom_target('gendat',
  7. output : 'generated.dat',
  8. input : 'source.txt',
  9. command : [py3] + comp + ['@INPUT@', '@OUTPUT@'],
  10. build_by_default : true,
  11. )
  12. ct_output = join_paths(meson.build_root(), 'generated.dat')
  13. exe_output = join_paths(meson.build_root(), 'fooprog')
  14. if host_machine.system() == 'windows'
  15. exe_output += '.exe'
  16. endif
  17. ct_exists_exe_nexists = 'import os.path, sys; sys.exit(not os.path.exists(sys.argv[1]) and os.path.exists(sys.argv[2]))'
  18. test('check-build-by-default', py3,
  19. args : ['-c', ct_exists_exe_nexists, ct_output, exe_output])