Giter Site home page Giter Site logo

zhuagenborn / cpp-project-template Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 13 KB

๐Ÿ—๏ธ A C++ project template built with Docker, Makefile, CMake, GoogleTest and GitHub Actions.

CMake 36.63% Dockerfile 4.31% C 9.51% C++ 22.78% PowerShell 5.03% Makefile 21.73%
cmake docker github-actions googletest makefile

cpp-project-template's Introduction

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
โ”‚       โ””โ”€โ”€ build-test.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

cpp-project-template's People

Contributors

czs108 avatar

Watchers

 avatar

Forkers

zfcflower

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.