meson.build 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #
  2. # build script written by : Michael Gene Brockus.
  3. # github repo author: Mike Karlesky, Mark VanderVoord, Greg Williams.
  4. #
  5. # license: MIT
  6. #
  7. project('unity', 'c',
  8. license: 'MIT',
  9. # Set project version to value extracted from unity.h header
  10. version: run_command(
  11. [
  12. 'auto/extract_version.py',
  13. 'src/unity.h'
  14. ],
  15. check: true
  16. ).stdout().strip(),
  17. meson_version: '>=0.47.0',
  18. default_options: [
  19. 'werror=true',
  20. 'c_std=c11'
  21. ]
  22. )
  23. build_fixture = get_option('extension_fixture')
  24. build_memory = get_option('extension_memory')
  25. support_double = get_option('support_double')
  26. unity_args = []
  27. unity_src = []
  28. unity_inc = []
  29. subdir('src')
  30. if build_fixture
  31. # Building the fixture extension implies building the memory
  32. # extension.
  33. build_memory = true
  34. subdir('extras/fixture/src')
  35. endif
  36. if build_memory
  37. subdir('extras/memory/src')
  38. endif
  39. if support_double
  40. unity_args += '-DUNITY_INCLUDE_DOUBLE'
  41. endif
  42. unity_lib = static_library(meson.project_name(),
  43. sources: unity_src,
  44. c_args: unity_args,
  45. include_directories: unity_inc,
  46. install: not meson.is_subproject(),
  47. )
  48. unity_dep = declare_dependency(
  49. link_with: unity_lib,
  50. include_directories: unity_inc
  51. )
  52. # Generate pkg-config file.
  53. if not meson.is_subproject()
  54. pkg = import('pkgconfig')
  55. pkg.generate(
  56. name: meson.project_name(),
  57. version: meson.project_version(),
  58. libraries: [ unity_lib ],
  59. description: 'C Unit testing framework.'
  60. )
  61. endif
  62. # Create a generator that can be used by consumers of our build system to generate
  63. # test runners.
  64. gen_test_runner = generator(
  65. find_program('auto/generate_test_runner.rb'),
  66. output: '@BASENAME@_Runner.c',
  67. arguments: ['@INPUT@', '@OUTPUT@']
  68. )