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.
32 lines
868 B
32 lines
868 B
8 years ago
|
project('alignment', 'c', 'cpp')
|
||
11 years ago
|
|
||
8 years ago
|
compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')]
|
||
11 years ago
|
|
||
8 years ago
|
foreach cc : compilers
|
||
|
# These tests should return the same value on all
|
||
|
# platforms. If (and when) they don't, fix 'em up.
|
||
|
if cc.alignment('char') != 1
|
||
|
error('Alignment of char misdetected.')
|
||
|
endif
|
||
11 years ago
|
|
||
8 years ago
|
ptr_size = cc.sizeof('void*')
|
||
|
dbl_alignment = cc.alignment('double')
|
||
11 years ago
|
|
||
8 years ago
|
# These tests are not thorough. Doing this properly
|
||
|
# would take a lot of work because it is strongly
|
||
|
# platform and compiler dependent. So just check
|
||
|
# that they produce something fairly sane.
|
||
10 years ago
|
|
||
8 years ago
|
if ptr_size == 8 or ptr_size == 4
|
||
|
message('Size of ptr ok.')
|
||
|
else
|
||
|
error('Size of ptr misdetected.')
|
||
|
endif
|
||
11 years ago
|
|
||
8 years ago
|
if dbl_alignment == 8 or dbl_alignment == 4
|
||
|
message('Alignment of double ok.')
|
||
|
else
|
||
|
error('Alignment of double misdetected.')
|
||
|
endif
|
||
|
endforeach
|