Merge pull request #2 from nico202/patch-2

meson: Use system doctest if available
This commit is contained in:
DeepBlueV7.X 2021-01-20 15:21:00 +01:00 committed by GitHub
commit 94037f70b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -11,7 +11,11 @@
#endif
#ifdef DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#if __has_include(<doctest.h>)
#include <doctest.h>
#else
#include <doctest/doctest.h>
#endif
#endif
using namespace std::literals;

View file

@ -6,8 +6,8 @@ lib = static_library('blurhash',
'blurhash.cpp',
install : true)
doctest_proj = subproject('doctest')
doctest_dep = doctest_proj.get_variable('doctest_dep')
doctest_dep = dependency('doctest', fallback : ['doctest', 'doctest_dep'])
tests = executable('blurhash-tests',
'blurhash.cpp',
cpp_args : '-DDOCTEST_CONFIG_IMPLEMENT_WITH_MAIN',
@ -17,3 +17,13 @@ test('blurhash-tests', tests)
executable('blurhash2bmp', 'blurhash2bmp.cpp', link_with: lib, install: true)
executable('blurhash', 'image2blurhash.cpp', link_with: lib, install: true)
install_headers('blurhash.hpp')
pkg = import('pkgconfig')
pkg.generate(libraries : [lib],
subdirs : ['.'],
version : meson.project_version(),
name : meson.project_name(),
filebase : meson.project_name(),
description : 'C++ blurhash encoder/decoder')