Update meson dependency usage

This commit is contained in:
ado 2023-02-01 00:52:23 +01:00
parent 5cb3c65b24
commit f2b49e6d6c
5 changed files with 9 additions and 13 deletions

View File

@ -632,6 +632,5 @@ revision = origin/master
``` ```
Then simply fetch the dependency and it is ready to be used: Then simply fetch the dependency and it is ready to be used:
```meson ```meson
ssp_sub = subproject('ssp') ssp_dep = dependency('ssp')
ssp_dep = ssp_sub.get_variable('ssp_dep')
``` ```

View File

@ -2,16 +2,19 @@ project('ssp', 'cpp',
default_options : default_options :
['warning_level=3', ['warning_level=3',
'cpp_std=c++17', 'cpp_std=c++17',
'buildtype=debugoptimized']) 'buildtype=debugoptimized'],
meson_version:'>=0.54.0')
fast_float_sub = subproject('fast_float') fast_float_dep = dependency('fast_float')
fast_float_dep = fast_float_sub.get_variable('fast_float_dep')
ssp_dep = declare_dependency( ssp_dep = declare_dependency(
include_directories: include_directories('include'), include_directories: include_directories('include'),
dependencies: fast_float_dep dependencies: fast_float_dep
) )
meson.override_dependency('ssp', ssp_dep)
if not meson.is_subproject() if not meson.is_subproject()
subdir('test') subdir('test')
endif endif

View File

@ -7,8 +7,7 @@ test_sources = files([
'test_extractions_without_fast_float.cpp', 'test_extractions_without_fast_float.cpp',
]) ])
doctest_proj = subproject('doctest') doctest_dep = dependency('doctest')
doctest_dep = doctest_proj.get_variable('doctest_dep')
test_exe = executable( test_exe = executable(
'test_ssp', 'test_ssp',

View File

@ -1,12 +1,7 @@
#pragma once #pragma once
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#ifdef CMAKE_GITHUB_CI
#include <doctest/doctest.h> #include <doctest/doctest.h>
#else
#include <doctest.h>
#endif
struct buffer { struct buffer {
char* data_{nullptr}; char* data_{nullptr};

View File

@ -1,2 +1,2 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest.h> #include <doctest/doctest.h>