The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
982 B
34 lines
982 B
8 years ago
|
project('sizeof', 'c', 'cpp')
|
||
12 years ago
|
|
||
8 years ago
|
# Test with C
|
||
12 years ago
|
cc = meson.get_compiler('c')
|
||
8 years ago
|
|
||
12 years ago
|
intsize = cc.sizeof('int')
|
||
12 years ago
|
wcharsize = cc.sizeof('wchar_t', prefix : '#include<wchar.h>')
|
||
12 years ago
|
|
||
|
cd = configuration_data()
|
||
|
cd.set('INTSIZE', intsize)
|
||
12 years ago
|
cd.set('WCHARSIZE', wcharsize)
|
||
8 years ago
|
cd.set('CONFIG', 'config.h')
|
||
12 years ago
|
configure_file(input : 'config.h.in', output : 'config.h', configuration : cd)
|
||
8 years ago
|
s = configure_file(input : 'prog.c.in', output : 'prog.c', configuration : cd)
|
||
12 years ago
|
|
||
8 years ago
|
e = executable('prog', s)
|
||
12 years ago
|
test('sizeof test', e)
|
||
8 years ago
|
|
||
|
# Test with C++
|
||
|
cpp = meson.get_compiler('cpp')
|
||
|
|
||
|
intsize = cpp.sizeof('int')
|
||
|
wcharsize = cpp.sizeof('wchar_t', prefix : '#include<wchar.h>')
|
||
|
|
||
|
cdpp = configuration_data()
|
||
|
cdpp.set('INTSIZE', intsize)
|
||
|
cdpp.set('WCHARSIZE', wcharsize)
|
||
|
cdpp.set('CONFIG', 'config.hpp')
|
||
|
configure_file(input : 'config.h.in', output : 'config.hpp', configuration : cdpp)
|
||
|
spp = configure_file(input : 'prog.c.in', output : 'prog.cc', configuration : cdpp)
|
||
|
|
||
|
epp = executable('progpp', spp)
|
||
|
test('sizeof test c++', epp)
|