Debian Codegraph @

vendored-meson/meson/test cases/common/30 sizeof/meson.build

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