Skip to content

Boilerplate C++ Project

Purpose

A Debian-flavored Linux or Windows OS is assumed here.

Set up a DevOps repository for C++ development using the Qt-framework applications for Linux and Windows by using the following tools in a Linux environment.

Qt Platform Libraries (Linux + Windows)

The Qt-applications are built using for Linux and Windows platforms where both are built on a Linux platform, one using a GNU cross-compiler for Windows.

To achieve this the Qt Windows library is modified to use Linux application like for compiling the Qt resource and Windows resource files respectively *.qrc and *.rc files.

For specifics take a look at this page which is dedicated to it.

CMake Build Tool

CMake is the build-tool of the Qt-library and thus for the C++ applications using it.

To prevent duplication of cmake function/macros between projects a Git repository/submodule sf-cmake is created. The submodule contains common scripts which are used for building any project.

For example the build.sh script which calls the cmake/lib/bin/Build.sh which options are shown here.
It uses the CMakePresets.json project file v6 which includes workflow definitions.

Git Version Control System

Git is used as the version control system. To get the latest version of it follow this page here.

GitLab-CE CI/CD Pipelines

The community edition of GitLab is used to as a Git server and to perform the CI/CD pipelines.
To self-host a GitLab server follow this page here.

Docker

Docker is used for creating the images used for building and unit testing the project(s) in the GitLab pipelines and also when developing where CLion supports this seamlessly. To install Docker-CE follow this page here.

Docker C++ Build Image

To create the image needed for building a CMake a repository is created for this purpose. The DockerFile in combination with shell script cpp-builder.sh allows for easy image building.

For example:

# Build the docker image locally.
./cpp-builder.sh build
# Push the image to the self hosted Sonatype Nexus server.
./cpp-builder.sh push

The resulting Docker image includes also Wine to enable performing unit-tests for the Windows builds.

Sonatype Nexus Repository

To install a Nexus service follow this here
The Nexus repository service is used for storing:

GitLab-Runner

Runners for GitLab. can be installed on a bare-metal system but probably easier run them using a Docker image provided by GitLab.

The repository sf-docker-runner contains the:

The config directory is mounted as a volume to provide gitlab-runner configuration files.

DoxyGen Documentation Tool

Doxygen is used to create the documentation from source (C++ code) and accompanied Markdown files of the source code.
The Docker-image contains the Doxygen application and is set up by using CMake package sfDoxygen function Sf_AddDoxygenDocumentation() ( see: SfDoxygenConfig.cmake

In the Devops project, for example, it is used in the doc/CMakeLists.txt file.

Semantic Versioning using Conventional Commits

To facilitate automatic version bumping by selecting a certain merge commit (e.g. by a Product Owner).

A start has been made using a shell script version-bump.sh which is explained in the README.md

In a perfect world a web-application should use the GitLab REST API to perform this version bumping.
For now a simple shell script performs this on a local checked out Git repository.