Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergeyklay/ytc
An yaml-cpp example project.
https://github.com/sergeyklay/ytc
cmake cmake-examples codecov conan conan-examples coverage cpp cpp-examples cpp17 gtest yaml yaml-cpp
Last synced: 26 days ago
JSON representation
An yaml-cpp example project.
- Host: GitHub
- URL: https://github.com/sergeyklay/ytc
- Owner: sergeyklay
- License: mit
- Created: 2019-12-10T22:19:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T18:47:39.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T10:51:38.663Z (about 1 month ago)
- Topics: cmake, cmake-examples, codecov, conan, conan-examples, coverage, cpp, cpp-examples, cpp17, gtest, yaml, yaml-cpp
- Language: C++
- Size: 116 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YTC
[![Actions Status][actions badge]][actions link]
[![License: MIT][license badge]](./LICENSE)YTC (a Yaml Template Class example) is an `yaml-cpp` example project.
The main goal of this project is to show a possible strategy to convert user data types using
[yaml-cpp][yaml-cpp link].This project build with following tools:
- C++ version: `C++17`
- C++ compiler: **Gcc**, **Clang** and **Apple Clang**
- Source: multiple files
- Package manager: [Conan][conan link]
- Build system: [CMake][cmake link]
- Libraries: STL, [`yaml-cpp`][yaml-cpp link]
- Code coverage report: [`lcov`][lcov link]
- Testing framework: [Google Tests][gtest link]
- CI: [GitHub Actions][actions feature]## How to try it out
These instructions will get you a copy of the project up and running on your local machine for
development and testing purposes.### Prerequisites
To build YTC you need the following requirements:
- A C++ compiler such as [Gcc][gcc link] >= 7.0.0, [Clang][clang link] >= 5.0.0 or [Apple Clang][apple link] >= 10.0.0
- [CMake][cmake link] 3.11 or later
- [Conan][conan link] decentralized package manager with a client-server architectureTo enable test coverage reports you need the following requirements:
- `lcov`
- `genhtml`For project dependencies list see `conanfile.txt` bundled with this project.
If you're using Ubuntu, you can install the required packages this way:
```shell script
sudo apt install gcc cmake build-essential
```On macOS you most likely have a compiler so you'll need only cmake:
```shell script
brew install cmake
```Please note that specific versions of libraries and programs at the time of reading this guide may vary.
The following dependencies is recommended install using [`pip`][pip link]:- `conan`
They can be installed using pip as follows:
```shell script
pip install -r requirements.txt
```### Building
First you'll need clone the project and fetch its modules:
```shell script
git clone https://github.com/sergeyklay/ytc
cd ytc
```Then build project as follows:
```shell script
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug
cmake --build build
```### Running the tests
Tests expect `YTC_TESTS_ROOT` environment variable to use fixtures. This
variable should point to the tests directory root. Set this variable and
run the tests as follows:```shell script
export YTC_TESTS_ROOT=$(pwd)/tests
cmake --build build --target check
```### Generate HTML code coverage report
Follow these steps:
1. Configure with code coverage instrumentation enabled `-DCODE_COVERAGE=ON`
2. Build project
3. Execute the tests to generate the coverage data
4. Generate and customize reports as follows:```shell script
# Create lcov report
lcov --directory build --capture --output-file ./build/coverage.info# Filter out extra files
lcov \
--remove ./build/coverage.info \
'/usr/*' \
"${HOME}"'/.conan/*' \
'*/tests/*' \
--output-file ./build/coverage.info# Output coverage data for debugging (Optional)
lcov --list ./build/coverage.info# Create a directory to store HTML report
mkdir ./build/coverage# Generate HTML report
genhtml ./build/coverage.info --output-directory ./build/coverage
```## Further Reading
- [Conan Examples][conan examples]
- [yaml-cpp tutorial][yaml tutor]## License
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
[actions link]: https://github.com/sergeyklay/ytc/actions
[actions badge]: https://github.com/sergeyklay/ytc/workflows/build/badge.svg
[license badge]: https://img.shields.io/badge/License-MIT-blue.svg
[yaml-cpp link]: https://github.com/jbeder/yaml-cpp
[yaml tutor]: https://github.com/jbeder/yaml-cpp/wiki/Tutorial
[gcc link]: https://gcc.gnu.org
[clang link]: https://clang.llvm.org
[apple link]: https://apps.apple.com/us/app/xcode/id497799835
[cmake link]: https://cmake.org
[conan link]: https://conan.io
[conan examples]: https://github.com/conan-io/examples
[pip link]: https://pip.pypa.io
[gtest link]: https://github.com/google/googletest
[actions feature]: https://github.com/features/actions
[lcov link]: http://ltp.sourceforge.net/coverage/lcov.php