Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

🏗️ A C++ project template built with Docker, Makefile, CMake, GoogleTest and GitHub Actions.(包含Docker、Makefile、CMake、GoogleTest和GitHub Actions的C++项目构建模板。)

Notifications You must be signed in to change notification settings

Zhuagenborn/Cpp-Project-Template

Repository files navigation

C++ Project Template

C++ PowerShell CMake Make Docker GitHub Actions Linux

Introduction

A C++ project template on Ubuntu built with:

Building with CMake

Prerequisites

  • Install GoogleTest.
  • Install CMake.

Building

Go to the project folder and run:

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

Running Tests

Go to the build folder and run:

ctest -VV

Running the Main Program

Go to the build/bin folder and run:

./cpp-sample

Building with Docker

Prerequisites

  • Install Docker.

Building

Go to the project folder and run the following command to create an image:

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>

Building with Make

Currently Makefile does not support GoogleTest.

Building

Go to the project folder and run:

make

Running the Main Program

Go to the build folder and run:

./cpp-sample

Structure

.
├── .github
│   └── workflows
│       ├── cmake-gtest.yaml
│       ├── docker.yaml
│       └── make.yaml
├── cmake
│   └── hello.cmake
├── docs
│   └── badges
│       ├── C++.svg
│       ├── Linux.svg
│       ├── Made-with-CMake.svg
│       ├── Made-with-Make.svg
│       ├── Made-with-Docker.svg
│       ├── Made-with-GitHub-Actions.svg
│       └── PowerShell.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
├── Build-CMake.ps1
├── CITATION.cff
├── CMakeLists.txt
├── Dockerfile
├── Makefile
└── README.md

About

🏗️ A C++ project template built with Docker, Makefile, CMake, GoogleTest and GitHub Actions.(包含Docker、Makefile、CMake、GoogleTest和GitHub Actions的C++项目构建模板。)

Topics

Resources

Stars

Watchers

Forks