czs108 / Cpp-Project-Template

πŸ—οΈ A C++ project template built with Docker, Makefile, CMake, GoogleTest and GitHub Actions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C++ Project Template

C++ CMake Docker Linux

Introduction

A C++ project template built with:

Building without Docker

Prerequisites

  • Install GoogleTest.
  • Install CMake.

Building

Set the location to the project folder and run:

mkdir build
cd build
cmake ..
cmake --build .

Running Tests

Set the location to the build folder and run:

ctest -VV

Running the Main Program

Set the location to the build/bin folder and run:

./cpp-sample

Building with Docker

Prerequisites

  • Install Docker.

Building

Set the location to the project folder and run:

docker image build . -t <image>

<image> should be replaced with a custom Docker image name.

Running Tests

docker container run <image> ctest --test-dir .. -VV

Running the Main Program

docker container run <image>

Structure

.
β”œβ”€β”€ .github
β”‚   └── workflows
β”‚       └── build-test.yaml
β”œβ”€β”€ cmake
β”‚   └── hello.cmake
β”œβ”€β”€ docs
β”‚   └── badges
β”‚       β”œβ”€β”€ C++.svg
β”‚       β”œβ”€β”€ Linux.svg
β”‚       β”œβ”€β”€ Made-with-CMake.svg
β”‚       └── Made-with-Docker.svg
β”œβ”€β”€ include
β”‚   └── foo
β”‚       └── foo.h
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ foo
β”‚   β”‚   β”œβ”€β”€ CMakeLists.txt
β”‚   β”‚   β”œβ”€β”€ foo.cpp
β”‚   β”‚   β”œβ”€β”€ private_foo_test.cpp
β”‚   β”‚   β”œβ”€β”€ private_foo.cpp
β”‚   β”‚   └── private_foo.h
β”‚   β”œβ”€β”€ CMakeLists.txt
β”‚   └── main.cpp
β”œβ”€β”€ tests
β”‚   β”œβ”€β”€ CMakeLists.txt
β”‚   └── foo_test.cpp
β”œβ”€β”€ .clang-format
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CITATION.cff
β”œβ”€β”€ CMakeLists.txt
β”œβ”€β”€ Dockerfile
└── README.md

About

πŸ—οΈ A C++ project template built with Docker, Makefile, CMake, GoogleTest and GitHub Actions.


Languages

Language:CMake 50.0%Language:C++ 31.1%Language:C 13.0%Language:Dockerfile 5.9%