Skip to content

ansonmiu0214/boilerplate-cpp

Repository files navigation

C++ Boilerplate Repository

Opinionated sample C++ project scaffolding with a few useful bells and whistles!


Features | Directory Layout | Getting Started | Learn More


Features

  • ✅ CMake
  • ✅ Docker
  • ✅ GoogleTest
  • ✅ Valgrind
  • ✅ Conan package manager
  • ✅ VS Code
    • Header include paths
    • Launch configuration for debugging
    • Remote Docker container setup

🗺 Directory Layout

File/Directory Description
.conan/conanfile.txt List dependencies to be installed via Conan package manager
.devcontainer/devcontainer.json Config for VS Code to create development container
.vscode/ Configs for VS Code to set up include paths (for IntelliSense) and launch targets (for debugging)
apps/ Directory for executables created by this project
include/myproject/ Directory for the header files exposed by libraries created by this project (named myproject)
src/ Directory for implementation files and private headers used by libraries created by this project
docker-compose.yml Config for starting development container
Dockerfile Blueprint for development environment setup

💻 Getting Started

$ pwd
/path/to/boilerplate-cpp

# For VS Code users, open the repository in VS Code and select to
# reopen the folder in a container -- VS Code should auto-detect the
# `devcontainer.json` config.
$ docker-compose run dev bash

# Build and run tests
dev@dev:/workarea $ make

# Run Valgrind on tests
dev@dev:/workarea $ make valgrind

# Run the sample executable
dev@dev:/workarea $ ./build/bin/calculator add 12 34
Hello, world!
12 + 34 = 46
⚠️ Note for VS Code users

Instead of docker-compose, you can open the cloned repository in VS Code and you should be prompted to reopen the folder in a container.

🔎 Learn More