meson.build 1.0 KB

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