meson: Use system doctest if available

* meson.build (doctest_proj): check if available as system dependency
* blurhash.cpp: change doctest include path to doctest/doctest.h
This commit is contained in:
Nicolò Balzarotti 2021-01-20 10:29:22 +01:00 committed by nixo
parent 9b94940251
commit 445c7d81f5
2 changed files with 8 additions and 3 deletions

View file

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

View file

@ -6,8 +6,13 @@ lib = static_library('blurhash',
'blurhash.cpp', 'blurhash.cpp',
install : true) install : true)
doctest_dep = dependency('doctest', required : false)
if not doctest_dep.found()
doctest_proj = subproject('doctest') doctest_proj = subproject('doctest')
doctest_dep = doctest_proj.get_variable('doctest_dep') doctest_dep = doctest_proj.get_variable('doctest_dep')
endif
tests = executable('blurhash-tests', tests = executable('blurhash-tests',
'blurhash.cpp', 'blurhash.cpp',
cpp_args : '-DDOCTEST_CONFIG_IMPLEMENT_WITH_MAIN', cpp_args : '-DDOCTEST_CONFIG_IMPLEMENT_WITH_MAIN',