| 1 |
project('c++ and assembly test') |
| 2 |
add_languages('cpp') |
| 3 |
|
| 4 |
if meson.backend() == 'xcode' |
| 5 |
error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') |
| 6 |
endif |
| 7 |
|
| 8 |
cpp = meson.get_compiler('cpp') |
| 9 |
cpu = host_machine.cpu_family() |
| 10 |
|
| 11 |
supported_cpus = ['arm', 'x86', 'x86_64'] |
| 12 |
|
| 13 |
if not supported_cpus.contains(cpu) |
| 14 |
error('MESON_SKIP_TEST unsupported cpu:' + cpu) |
| 15 |
endif |
| 16 |
|
| 17 |
if cpp.symbols_have_underscore_prefix() |
| 18 |
add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language : 'cpp') |
| 19 |
endif |
| 20 |
|
| 21 |
sources = ['trivial.cc'] |
| 22 |
# If the compiler cannot compile assembly, don't use it |
| 23 |
if not ['msvc', 'clang-cl', 'intel-cl'].contains(meson.get_compiler('cpp').get_id()) |
| 24 |
sources += ['retval-' + cpu + '.S'] |
| 25 |
cpp_args = ['-DUSE_ASM'] |
| 26 |
message('Using ASM') |
| 27 |
else |
| 28 |
cpp_args = ['-DNO_USE_ASM'] |
| 29 |
endif |
| 30 |
|
| 31 |
exe = executable('trivialprog', sources, |
| 32 |
cpp_args : cpp_args) |
| 33 |
test('runtest', exe) |