Skip to content

Tomcat-42/cppplate

Repository files navigation

cppplate

A modern C++2x project template, using xmake, Github Actions and Docker.

Tools

Xmake

xmake is a fully-fledged and modern C++ package manager + build system + project generator. For installation and usage refer to its docs.

Installing deps

xrepo install <PKG>

Building

xmake build <TARGET>

Running

xmake run <TARGET>

Installing

xmake install

Project structure and configuration

All the project configuration is done in the file ./xmake.lua(refer to xmake docs). The basic struture is as follows:

  • A provider shared library that abstracts all the domain logic (classes, functions, ...). (lib.a)
  • Any number of consumers targets that should use the provider library (e.g. app).
  • A unit test target.
  • A benchmark target.

Docker

The project use the cppdev environment for building.

The scripts ./scripts/build, ./scripts/test and ./scripts/publish are usefull for building the project inside a Docker container. Refer to the ./Dockerfile for configuration, multi-stage build and other tweaks.

Doxygen

This project uses the Doxygen doc generation. Refer the ./Doxyfile for configuration. You can run doxygen for generating the docs.

Github Actions

For a CI/CD pipeline, the Github Actions tool is used. The default configuration is located in ./.github/workflows/cicd.yml, and describes a simple cascading pipeline:

  • The project is built in a container.
  • The targets are copied to the host.
  • Unit tests are executed.
  • A docker image is published
  • A github release is published.