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