Setting up a new C++ project usually requires a significant amount of preparation and boilerplate code, even more so for modern C++ projects with tests, executables and contiguous integration. This template is the result of learnings from many previous projects and should help reduce the work required to setup up a modern C++ project.
- Modern XMake practices
- Suited for single header libraries and projects of any scale
- Separation into library and executable code
- Integrated test suite
- Continuous integration via GitHub Actions
- Code formatting enforced by clang-format
- Reproducible dependency management via xmake-repo
- Support for sanitizer tools and more
- Use this repo as a template and replace all occurrences of "Greeter" in the relevant xmake.lua with the name of your project
- Replace the source files with your own
- For single-header libraries: see the comments in xmake.lua
- Happy coding!
Eventually, you can remove any unused files, such as the standalone directory or irrelevant github workflows for your project. Feel free to replace the License with one suited for your project.
Use the following command to build and run the executable target.
xmake
xmake run
xmake run standalone --help
Use the following commands from the project's root directory to run the test suite.
xmake build test
xmake run test
To collect code coverage information, run:
xmake f -m coverage
xmake build test
xmake run test