Skip to content

Commit 94037f7

Browse files
authored
Merge pull request #2 from nico202/patch-2
meson: Use system doctest if available
2 parents 9b94940 + e7d1113 commit 94037f7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

blurhash.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
#endif
1212

1313
#ifdef DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
14+
#if __has_include(<doctest.h>)
1415
#include <doctest.h>
16+
#else
17+
#include <doctest/doctest.h>
18+
#endif
1519
#endif
1620

1721
using namespace std::literals;

meson.build

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ lib = static_library('blurhash',
66
'blurhash.cpp',
77
install : true)
88

9-
doctest_proj = subproject('doctest')
10-
doctest_dep = doctest_proj.get_variable('doctest_dep')
9+
doctest_dep = dependency('doctest', fallback : ['doctest', 'doctest_dep'])
10+
1111
tests = executable('blurhash-tests',
1212
'blurhash.cpp',
1313
cpp_args : '-DDOCTEST_CONFIG_IMPLEMENT_WITH_MAIN',
@@ -17,3 +17,13 @@ test('blurhash-tests', tests)
1717

1818
executable('blurhash2bmp', 'blurhash2bmp.cpp', link_with: lib, install: true)
1919
executable('blurhash', 'image2blurhash.cpp', link_with: lib, install: true)
20+
21+
install_headers('blurhash.hpp')
22+
23+
pkg = import('pkgconfig')
24+
pkg.generate(libraries : [lib],
25+
subdirs : ['.'],
26+
version : meson.project_version(),
27+
name : meson.project_name(),
28+
filebase : meson.project_name(),
29+
description : 'C++ blurhash encoder/decoder')

0 commit comments

Comments
 (0)