meson.build 982 B

12345678910111213141516171819202122232425262728293031323334
  1. project('sizeof', 'c', 'cpp')
  2. # Test with C
  3. cc = meson.get_compiler('c')
  4. intsize = cc.sizeof('int')
  5. wcharsize = cc.sizeof('wchar_t', prefix : '#include<wchar.h>')
  6. cd = configuration_data()
  7. cd.set('INTSIZE', intsize)
  8. cd.set('WCHARSIZE', wcharsize)
  9. cd.set('CONFIG', 'config.h')
  10. configure_file(input : 'config.h.in', output : 'config.h', configuration : cd)
  11. s = configure_file(input : 'prog.c.in', output : 'prog.c', configuration : cd)
  12. e = executable('prog', s)
  13. test('sizeof test', e)
  14. # Test with C++
  15. cpp = meson.get_compiler('cpp')
  16. intsize = cpp.sizeof('int')
  17. wcharsize = cpp.sizeof('wchar_t', prefix : '#include<wchar.h>')
  18. cdpp = configuration_data()
  19. cdpp.set('INTSIZE', intsize)
  20. cdpp.set('WCHARSIZE', wcharsize)
  21. cdpp.set('CONFIG', 'config.hpp')
  22. configure_file(input : 'config.h.in', output : 'config.hpp', configuration : cdpp)
  23. spp = configure_file(input : 'prog.c.in', output : 'prog.cc', configuration : cdpp)
  24. epp = executable('progpp', spp)
  25. test('sizeof test c++', epp)