meson.build 968 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. project('Unity example', 'c',
  2. license: 'MIT',
  3. default_options: [
  4. 'c_std=c99',
  5. 'warning_level=3',
  6. ],
  7. meson_version: '>= 0.49.0'
  8. )
  9. unity_subproject = subproject('unity')
  10. unity_dependency = unity_subproject.get_variable('unity_dep')
  11. unity_gen_runner = unity_subproject.get_variable('gen_test_runner')
  12. src1 = files([
  13. 'src' / 'ProductionCode.c',
  14. 'test' / 'TestProductionCode.c',
  15. ])
  16. src2 = files([
  17. 'src' / 'ProductionCode2.c',
  18. 'test' / 'TestProductionCode2.c',
  19. ])
  20. inc = include_directories('src')
  21. test1 = executable('test1',
  22. sources: [
  23. src1,
  24. unity_gen_runner.process('test' / 'TestProductionCode.c')
  25. ],
  26. include_directories: [ inc ],
  27. dependencies: [ unity_dependency ],
  28. )
  29. test('test1', test1,
  30. should_fail: true)
  31. test2 = executable('test2',
  32. sources: [
  33. src2,
  34. unity_gen_runner.process('test' / 'TestProductionCode2.c')
  35. ],
  36. include_directories: [ inc ],
  37. dependencies: [ unity_dependency ],
  38. )
  39. test('test2', test2)