2020-02-24 20:39:13 +00:00
|
|
|
|
# Contributing to toml++
|
2022-09-24 15:49:34 +00:00
|
|
|
|
|
2020-02-24 20:39:13 +00:00
|
|
|
|
Contributions are very welcome! Either by [reporting issues] or submitting pull requests.
|
|
|
|
|
If you wish to submit a PR, please be aware that:
|
2022-09-24 15:49:34 +00:00
|
|
|
|
|
2023-08-26 14:25:35 +00:00
|
|
|
|
- The single-header `toml.hpp` at the repository root is generated by a script, so don't change it directly; make your
|
|
|
|
|
changes in the files in `include`.
|
2023-01-22 19:53:21 +00:00
|
|
|
|
- Your changes should compile warning-free on at least one of:
|
|
|
|
|
- GCC 8 or higher
|
|
|
|
|
- Clang 8 or higher
|
|
|
|
|
- MSVC 19.2X (Visual Studio 2019) or higher
|
2023-08-26 14:25:35 +00:00
|
|
|
|
- You should regenerate the single-header version of `toml.hpp` as part of your PR (a CI check will fail if you don't).
|
2020-02-24 20:39:13 +00:00
|
|
|
|
|
2020-04-01 12:53:10 +00:00
|
|
|
|
<br>
|
|
|
|
|
|
2023-08-26 14:25:35 +00:00
|
|
|
|
## Regenerating the single-header toml.hpp
|
2022-09-24 15:49:34 +00:00
|
|
|
|
|
2020-02-24 20:39:13 +00:00
|
|
|
|
1. Make your changes as necessary
|
2020-04-01 12:53:10 +00:00
|
|
|
|
- If you've added a new header file that isn't going to be transitively included by one of the
|
2023-08-26 14:25:35 +00:00
|
|
|
|
others, add an include directive to `include/toml++/toml.hpp`
|
2021-04-18 12:04:46 +00:00
|
|
|
|
2. Install the prerequisite python packages: `pip3 install -r tools/requirements.txt`
|
|
|
|
|
3. Run `tools/generate_single_header.py`
|
2020-02-24 20:39:13 +00:00
|
|
|
|
|
2020-04-01 12:53:10 +00:00
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
## Building and running the tests
|
2022-09-24 15:49:34 +00:00
|
|
|
|
|
2022-05-01 12:09:09 +00:00
|
|
|
|
Testing is done using [Catch2].
|
2020-02-24 20:39:13 +00:00
|
|
|
|
|
2020-04-01 12:53:10 +00:00
|
|
|
|
### Testing on Windows with Visual Studio
|
2020-02-24 20:39:13 +00:00
|
|
|
|
|
2022-01-03 18:51:03 +00:00
|
|
|
|
Install [Visual Studio] and [Test Adapter for Catch2], then open `toml++.sln` and build the
|
2020-02-24 20:39:13 +00:00
|
|
|
|
projects in the `tests` solution folder. Visual Studio's Test Explorer should pick these up and
|
|
|
|
|
allow you to run the tests directly.
|
|
|
|
|
|
2020-04-01 12:53:10 +00:00
|
|
|
|
If test discovery fails you can usually fix it by enabling
|
2020-02-24 20:39:13 +00:00
|
|
|
|
`Auto Detect runsettings Files` (settings gear icon > `Configure Run Settings`).
|
|
|
|
|
|
2020-04-01 12:53:10 +00:00
|
|
|
|
### Testing on Linux (and WSL)
|
2022-09-24 15:49:34 +00:00
|
|
|
|
|
2020-02-24 20:39:13 +00:00
|
|
|
|
```bash
|
2020-08-20 11:03:14 +00:00
|
|
|
|
# install ninja, meson, locales (first time only)
|
|
|
|
|
sudo apt update && sudo apt install -y locales python3 python3-pip ninja-build
|
|
|
|
|
sudo pip3 install meson
|
2020-09-05 10:26:12 +00:00
|
|
|
|
sudo locale-gen 'en_US.utf8' \
|
|
|
|
|
'ja_JP.utf8' \
|
|
|
|
|
'de_DE.utf8' \
|
|
|
|
|
'it_IT.utf8' \
|
|
|
|
|
'tr_TR.utf8' \
|
|
|
|
|
'fi_FI.utf8' \
|
|
|
|
|
'fr_FR.utf8' \
|
|
|
|
|
'zh_CN.utf8'
|
2020-08-20 11:03:14 +00:00
|
|
|
|
|
2020-07-30 20:31:08 +00:00
|
|
|
|
# create the build configs (first time only)
|
2023-01-22 19:53:21 +00:00
|
|
|
|
meson setup build-debug --buildtype=debug -Ddevel=true
|
|
|
|
|
meson setup build-release --buildtype=release -Ddevel=true
|
2020-07-30 20:31:08 +00:00
|
|
|
|
|
|
|
|
|
# run the tests
|
2023-01-22 19:53:21 +00:00
|
|
|
|
cd build-debug && ninja && ninja test \
|
|
|
|
|
&& cd ../build-release && ninja && ninja test \
|
2020-09-05 10:26:12 +00:00
|
|
|
|
&& cd ..
|
2020-02-24 20:39:13 +00:00
|
|
|
|
```
|
|
|
|
|
|
2022-09-24 15:49:34 +00:00
|
|
|
|
> ℹ️ Pass `-Duse_vendored_libs=false` to Meson if you wish to use the system-installed version
|
2023-01-22 19:53:21 +00:00
|
|
|
|
> of Catch2 rather than the vendored one.
|
2022-05-01 12:09:09 +00:00
|
|
|
|
|
2022-01-03 18:51:03 +00:00
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
## Testing with the [toml-test] suite
|
2022-09-24 15:49:34 +00:00
|
|
|
|
|
2022-01-03 18:51:03 +00:00
|
|
|
|
As an optional extra you may wish to test against the 'official' test TOML test suite, [BurntSushi/toml-test]. See the
|
|
|
|
|
instructions at [toml-test/README](./toml-test/README.md). Note that the toml++ tests already consume tests from the
|
|
|
|
|
offical suite via a C++ code-generation script so you are not expected to take this extra step as part of contributing
|
|
|
|
|
to the library.
|
2020-07-30 20:31:08 +00:00
|
|
|
|
|
2023-01-22 19:53:21 +00:00
|
|
|
|
[visual studio]: https://visualstudio.microsoft.com/vs/
|
|
|
|
|
[test adapter for catch2]: https://marketplace.visualstudio.com/items?itemName=JohnnyHendriks.ext01
|
2020-02-24 20:39:13 +00:00
|
|
|
|
[reporting issues]: https://github.com/marzer/tomlplusplus/issues
|
2023-01-22 19:53:21 +00:00
|
|
|
|
[catch2]: https://github.com/catchorg/Catch2
|
2022-01-03 18:51:03 +00:00
|
|
|
|
[toml-test]: https://github.com/BurntSushi/toml-test
|
2023-01-22 19:53:21 +00:00
|
|
|
|
[burntsushi/toml-test]: https://github.com/BurntSushi/toml-test
|