mirror of
https://github.com/marzer/tomlplusplus.git
synced 2026-01-19 04:52:09 +00:00
added meson option use_vendored_libs
This commit is contained in:
@@ -21,7 +21,7 @@ If you wish to submit a PR, please be aware that:
|
||||
<br>
|
||||
|
||||
## Building and running the tests
|
||||
Testing is done using [Catch2], vendored in the respository at `vendor/catch.hpp`.
|
||||
Testing is done using [Catch2].
|
||||
|
||||
### Testing on Windows with Visual Studio
|
||||
|
||||
@@ -60,9 +60,12 @@ cd build-gcc-debug && ninja && ninja test \
|
||||
&& cd ..
|
||||
```
|
||||
|
||||
> ℹ️ Note: To ensure parity between single-header and regular versions of the library, 50% of the tests
|
||||
> ℹ️ To ensure parity between single-header and regular versions of the library, 50% of the tests
|
||||
will be compiled using one, and 50% with the other. Ensure you've regenerated toml.hpp before running tests.
|
||||
|
||||
> ℹ️ Pass `-Duse_vendored_libs=false` to meson if you wish to use the system-installed version
|
||||
of Catch2 rather than the vendored one.
|
||||
|
||||
<br>
|
||||
|
||||
## Testing with the [toml-test] suite
|
||||
|
||||
@@ -10,3 +10,4 @@ option('ubsan_tests', type: 'boolean', value: false)
|
||||
option('build_tt_encoder', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder.')
|
||||
option('build_tt_decoder', type: 'boolean', value: false, description: 'Enable to build the toml-test decoder.')
|
||||
option('compile_library', type: 'boolean', value: false, description: 'Compile as a library')
|
||||
option('use_vendored_libs', type: 'boolean', value: true, description: 'Use the libs from the vendor dir when building tests.')
|
||||
|
||||
@@ -22,7 +22,15 @@
|
||||
#pragma warning(disable : 5105)
|
||||
#endif
|
||||
|
||||
#if !defined(USE_VENDORED_LIBS) || USE_VENDORED_LIBS
|
||||
#include "../vendor/catch.hpp"
|
||||
#elif __has_include(<Catch2/single_include/catch2/catch.hpp>)
|
||||
#include <Catch2/single_include/catch2/catch.hpp>
|
||||
#elif __has_include(<catch2/catch.hpp>)
|
||||
#include <catch2/catch.hpp>
|
||||
#else
|
||||
#error Catch2 is missing!
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@@ -29,9 +29,10 @@ test_sources = [
|
||||
'windows_compat.cpp'
|
||||
]
|
||||
|
||||
test_deps = [tomlplusplus_dep]
|
||||
|
||||
fs = import('fs')
|
||||
test_deps = [ tomlplusplus_dep ]
|
||||
if not get_option('use_vendored_libs')
|
||||
test_deps += dependency('catch2')
|
||||
endif
|
||||
|
||||
#######################################################################################################################
|
||||
# fast math check
|
||||
@@ -210,6 +211,10 @@ foreach cpp20 : cpp20_modes
|
||||
test_args += '-DUSE_SINGLE_HEADER=1'
|
||||
endif
|
||||
|
||||
if not get_option('use_vendored_libs')
|
||||
test_args += '-DUSE_VENDORED_LIBS=0'
|
||||
endif
|
||||
|
||||
test_executables += [[
|
||||
test_name,
|
||||
executable(
|
||||
|
||||
@@ -38,6 +38,9 @@ cd build_tt
|
||||
ninja && toml-test ./toml-test/tt_decoder && toml-test ./toml-test/tt_encoder --encoder
|
||||
```
|
||||
|
||||
> ℹ️ Pass `-Duse_vendored_libs=false` to meson if you wish to use the system-installed version
|
||||
of nlohmann/json rather than the vendored one.
|
||||
|
||||
|
||||
|
||||
[toml-test]: https://github.com/BurntSushi/toml-test
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
tt_deps = [
|
||||
tomlplusplus_dep
|
||||
]
|
||||
tt_deps = [ tomlplusplus_dep ]
|
||||
if not get_option('use_vendored_libs')
|
||||
tt_deps += dependency('nlohmann_json', fallback: ['json', 'nlohmann_json_dep'])
|
||||
endif
|
||||
|
||||
tt_args = []
|
||||
tt_args += devel_args
|
||||
if not get_option('use_vendored_libs')
|
||||
tt_args += '-DUSE_VENDORED_LIBS=0'
|
||||
endif
|
||||
|
||||
if get_option('build_tt_encoder')
|
||||
executable(
|
||||
'tt_encoder',
|
||||
'tt_encoder.cpp',
|
||||
cpp_args: devel_args,
|
||||
cpp_args: tt_args,
|
||||
dependencies: tt_deps
|
||||
)
|
||||
endif
|
||||
@@ -15,7 +22,7 @@ if get_option('build_tt_decoder')
|
||||
executable(
|
||||
'tt_decoder',
|
||||
'tt_decoder.cpp',
|
||||
cpp_args: devel_args,
|
||||
cpp_args: tt_args,
|
||||
dependencies: tt_deps
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -15,8 +15,17 @@
|
||||
#pragma warning(push, 0)
|
||||
#endif
|
||||
|
||||
#define JSON_HAS_FILESYSTEM 0
|
||||
#define JSON_HAS_FILESYSTEM 0
|
||||
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0
|
||||
#if !defined(USE_VENDORED_LIBS) || USE_VENDORED_LIBS
|
||||
#include "../vendor/json.hpp"
|
||||
#elif __has_include(<json/single_include/nlohmann/json.hpp>)
|
||||
#include <json/single_include/nlohmann/json.hpp>
|
||||
#elif __has_include(<nlohmann/json.hpp>)
|
||||
#include <nlohmann/json.hpp>
|
||||
#else
|
||||
#error nlohmann/json is missing!
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
5
vendor/README.md
vendored
5
vendor/README.md
vendored
@@ -2,7 +2,6 @@
|
||||
|
||||
The code files in this directory are third-party 'vendor' dependencies used by the various test applications.
|
||||
|
||||
⚠️ They are **not** required for regular use of toml++. ⚠️
|
||||
|
||||
⚠️ They are not **not** `#included` anywhere in toml++. ⚠️
|
||||
⚠️ They are **not** required for regular use of toml++.
|
||||
|
||||
⚠️ They are **not** `#included` anywhere in toml++.
|
||||
|
||||
Reference in New Issue
Block a user