Skip to content

00 Setup

Karn Kaul edited this page Oct 1, 2022 · 1 revision

Introduction

This project uses CMake 3.18+, C++20, and tries to be agnostic to development environments, without going too overboard. To that end, it uses some configuration files in the root directory:

  • .clang-format: Consistent formatting - requires clangd or built-in IDE integration, or running .clang-format manually over CLI
  • .editorconfig: Consistent file encodings, grouped by filename/extension patterns - requires Editor Config plugin/extension or built-in IDE integration
  • CMakePresets.json: Pre-configured presets for Ninja and Visual Studio; users can add more via CMakeUserPresets.json

Project Layout

The root directory is intended to be kept lean, with only the required files / directories there:

.clang-format       ]
.editorconfig       ]   configuration files
.gitignore          ]

CMakeLists.txt      ]   root CMake script
CMakePresets.json   ]   CMake presets

tray/               ]   parent for all source code (and related scripts)

The root CMake script sets up the project, global CMake flags, options if any, and delegates the target defintions to a sub-script in tray/.

Inside tray/ we set up the project, for now with just a contrived main file and a CMake script that adds it to an executable target:

tray/
  src/              ]   parent for C++ sources
    main.cpp
  CMakeLists.txt    ]   main project script
Clone this wiki locally