| 1 |
project('crosstest') |
| 2 |
|
| 3 |
add_languages('c', native: true) |
| 4 |
if get_option('generate') |
| 5 |
cc = meson.get_compiler('c', native: true) |
| 6 |
quoted = [] |
| 7 |
foreach part : cc.cmd_array() |
| 8 |
quoted += '\'' + part + '\'' |
| 9 |
endforeach |
| 10 |
|
| 11 |
conf_data = configuration_data() |
| 12 |
conf_data.set('c_compiler', '[' + ', '.join(quoted) + ']') |
| 13 |
conf_data.set('system', build_machine.system()) |
| 14 |
conf_data.set('cpu', build_machine.cpu()) |
| 15 |
conf_data.set('cpu_family', build_machine.cpu_family()) |
| 16 |
conf_data.set('endian', build_machine.endian()) |
| 17 |
conf_data.set('c_args', '-pedantic') |
| 18 |
|
| 19 |
configure_file(input: 'crossfile.in', |
| 20 |
output: 'crossfile', |
| 21 |
configuration: conf_data) |
| 22 |
configure_file(input: 'nativefile.in', |
| 23 |
output: 'nativefile', |
| 24 |
configuration: conf_data) |
| 25 |
message('Written native and cross file') |
| 26 |
|
| 27 |
add_languages('c', native: false) |
| 28 |
assert(get_option('build.c_args') == get_option('c_args')) |
| 29 |
else |
| 30 |
assert(meson.is_cross_build(), 'not setup as cross build') |
| 31 |
assert(get_option('build.c_args') == ['-pedantic']) |
| 32 |
endif |