Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vvvar/generator-cpp-github

Scaffolder for C++ CMake/Conan Project
https://github.com/vvvar/generator-cpp-github

cmake conan cpp cpp20 yeoman-generator

Last synced: about 1 month ago
JSON representation

Scaffolder for C++ CMake/Conan Project

Awesome Lists containing this project

README

        

# generator-cpp-github

Generator for [Yeoman](https://yeoman.io) that scaffolds cross-platform C++ projects with GitHub and VS Code integrations. [Example](https://github.com/vvvar/generator-cpp-github-example-app).

## Motivation

I like trying new ideas with C++. Setting up a new C++ project for me is so time-consuming that I often find myself spending more time configuring it than actually coding. On top of that, I tend to skip quality tools such as unit testing, SCA and linting in the early stages and then suffer to make them work with already-existing code base.
To address all that, I've made this generator. For myself. With technologies that I am often using. With structure that makes sense best to me. Then I thought it could be useful for somebody. So here it is.

## Installation

Pre-requisites:
- [Node.js 18.16.0+](https://nodejs.org/en/download)
- [Yeoman 4.3.1+](https://yeoman.io)
- [VS Code 1.77.3+](https://code.visualstudio.com)

```sh
npm install -g generator-cpp-github
```

## Usage

### Generate C++ Application into the current dir

```sh
yo cpp-github:app
code .
```

See an [example](https://github.com/vvvar/generator-cpp-github-example-app) of the project that has been generated with it.

### Generate C++ Library into the current dir

```sh
yo cpp-github:lib
code .
```

See an [example](https://github.com/vvvar/generator-cpp-github-example-lib) of the project that has been generated with it.

### Validate project folder structure

```sh
yo cpp-github:[type] --validate
```

This will check that your folder structure is the same as in the reference template.

## Tech Stack of the project that it will generate

- [C++20](https://en.cppreference.com/w/cpp/20)
- macOS([apple-clang 14](https://opensource.apple.com/source/clang/clang-23/clang/tools/clang/docs/UsersManual.html)), Linux([gcc 9](https://gcc.gnu.org/gcc-9/changes.html)) and Windows([MSVC 193](https://learn.microsoft.com/en-us/visualstudio/releases/2019/history))
- [just](https://github.com/casey/just)
- [Conan 2.0](https://docs.conan.io/2/)
- [CMake](https://cmake.org) + [ccache](https://ccache.dev) + [Ninja](https://ninja-build.org)(on all platforms)
- [GoogleTest](https://github.com/google/googletest)
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
- [Sonar Lint](https://www.sonarsource.com/products/sonarlint)
- [cppcheck](https://cppcheck.sourceforge.io)
- [Python 3](https://www.python.org) + [black](https://black.readthedocs.io/en/stable/)
- [Homebrew](https://brew.sh), [Chocolatey](https://chocolatey.org) and [Apt](https://wiki.debian.org/Apt)
- [GitHub Action](https://docs.github.com/en/actions)
- [Docker](https://www.docker.com)
- [VS Code](https://code.visualstudio.com) + [Grammarly](https://marketplace.visualstudio.com/items?itemName=znck.grammarly) + [CodeWhisper](https://aws.amazon.com/codewhisperer/)
- [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.en.html) license is generated by default just to have something. Not enforced

## Philosophy

- Use existing open-source tools as much as possible. Minimize custom solutions
- Prefer tools that are easy to set up over highly-customizable complex tools
- Prefer cross-toolchain tools over toolchain-specific solutions. Example - SonarLint over clang-tidy
- The project is as self-contained as possible. If something is needed to be installed/configured by the developer - there should be a task to do it within the project. Exception - task runner itself and basics such as git
- Everything should be usable from the local machine. No "CI-specific" solutions. Local ease of use is a priority
- Thin CI-integration. CI just executes the same tasks that the developer can execute locally
- Latest C++ standard
- Code-style is enforced
- Unit-testing is enforced
- Maximum possible SCA and linter strictness is enforced
- Dependencies should be versioned(where possible)
- If something is unused then it should be removed
- VS Code is the editor of choice. However, editor-independent solutions are preferred
- You should be able to build, test, debug and analyze the project without the editor. CLI solutions are preferred
- macOS, Linux and Windows are the target platforms
- [Trunk-based development](https://trunkbaseddevelopment.com)
- Forbid merge into the `main` unless PR passed all quality checks on a CI
- Squash merge strategy. Every commit in the `main` is self-contained
- Every commit in the `main` branch is a release candidate
- Every commit in the `main` branch has the unique version