1project('generated assembly', 'c')
2
3cc = meson.get_compiler('c')
4
5if ['msvc', 'clang-cl', 'intel-cl'].contains(cc.get_id())
6  error('MESON_SKIP_TEST: assembly files cannot be compiled directly by the compiler')
7endif
8
9cpu = host_machine.cpu_family()
10supported_cpus = ['arm', 'x86', 'x86_64']
11
12if not supported_cpus.contains(cpu)
13  error('MESON_SKIP_TEST: unsupported cpu family: ' + cpu)
14endif
15
16if cc.symbols_have_underscore_prefix()
17  add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language : 'c')
18endif
19
20copy = find_program('copyfile.py')
21output = 'square-@0@.S'.format(cpu)
22input = output + '.in'
23
24copygen = generator(copy,
25  arguments : ['@INPUT@', '@OUTPUT@'],
26  output : '@BASENAME@')
27
28l = shared_library('square-gen', copygen.process(input))
29
30test('square-gen-test', executable('square-gen-test', 'main.c', link_with : l))
31
32copyct = custom_target('square',
33  input : input,
34  output : output,
35  command : [copy, '@INPUT@', '@OUTPUT@'])
36
37l = shared_library('square-ct', copyct)
38
39test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l))
40