https://codeberg.org/interpeer/vessel.git
Raw File
Tip revision: 5c7a39214ce9b5396b7aafb9d576b159b57ef04a authored by Jens Finkhaeuser on 09 January 2024, 12:10:19 UTC
(void) and () have different meanings in C
Tip revision: 5c7a392
meson.build
##############################################################################
# Tests

# Tests in a subproject are complicicated. You need all the compile and
# link flags from the enclosing project, etc.
if not meson.is_subproject() and get_option('build_extras')
  gtest = subproject('gtest')

  # See https://github.com/google/googletest/issues/813
  test_args = []
  if host_machine.system() == 'cygwin'
    test_args += ['-D_POSIX_C_SOURCE=200809L']
  endif

  # Google test issues this warning; disable it in *test* code only.
  if compiler_id == 'msvc'
    test_args = [
      '/wd4389',
    ]
  endif

  # We're building two tests:
  # - public_tests include *only* public headers
  # - private_tests include private headers

  public_test_src = [
    'public' / 'author.cpp',
    'public' / 'extent.cpp',
    'public' / 'algorithms.cpp',
    'public' / 'sections.cpp',
    'public' / 'store.cpp',
    'public' / 'context.cpp',
    'public' / 'resource.cpp',

    'test_keys.cpp',
    'runner.cpp',
  ]

  private_test_src = [
    'private' / 'extent.cpp',
    'private' / 'author.cpp',
    'private' / 'serialization.cpp',
    'private' / 'content_type.cpp',
    'private' / 'payload.cpp',
    'private' / 'resource.cpp',

    'test_keys.cpp',
    'runner.cpp',
  ]

  if have_mman
    private_test_src += [
      'private' / 'pagers' / 'mmap.cpp',
    ]
  endif

  public_tests = executable('public_tests', public_test_src,
      dependencies: [
        main_build_dir, # XXX private headers include the build config
        dep_internal,
        gtest.get_variable('gtest_dep'),
      ],
      cpp_args: test_args,
  )
  test('public_tests', public_tests)

  # Due to symbol visibility, private tests won't link for non-debug builds
  if bt in ['debug', 'debugoptimized']
    private_tests = executable('private_tests', private_test_src,
        include_directories: [libincludes],  # Also private headers
        dependencies: [
          main_build_dir, # XXX private headers include the build config
          dep_internal,
          gtest.get_variable('gtest_dep'),
        ],
        cpp_args: cpp_define_args + test_args,
    )
    test('private_tests', private_tests)
  endif

  c_compiler = meson.get_compiler('c')
  c_compatibility = executable('c_compatibility', 'c_compatibility.c',
    dependencies: [
      dep_internal,
    ],
    link_language: 'c',
  )
  test('c_compatibility', c_compatibility)
endif
back to top