Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tstibor/mcppdev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcppdev

mcppdev is a simple, modern C++23 development skeleton.
It serves as a reference template for setting up a C++ project that uses C++20/23 Modules, Google Test, and Google Benchmark, all orchestrated by a modern CMake configuration.

The goal of this repository is to provide a minimal but correct example of how a modern C++ project can be structured today.


🚀 Features

  • C++23 Standard
    Configured for the latest standard (e.g. <print>, std::println).

  • C++ Modules
    Demonstrates how to define, compile, and import custom C++ modules (.cppm) using CMake’s CXX_MODULES file set.

  • Dependency Management
    Uses CMake FetchContent to automatically download and build dependencies.

  • Testing
    Integrated Google Test setup.

  • Benchmarking
    Integrated Google Benchmark setup.


📂 Project Structure

.
├── benchmarks/          # Google Benchmark code
│   └── benchmark.cpp
├── src/                 # Main source code and C++ Modules
│   ├── cppmhello.cppm   # Example C++ module
│   └── main.cpp         # Main entry point
├── tests/               # Unit tests
│   └── test.cpp
├── CMakeLists.txt       # CMake build configuration
└── build.sh             # Build helper script

🛠 Prerequisites

To build this project, you need tools with C++23 and Modules support:

  • CMake: 3.30 or newer
  • Compiler (one of):
    • Clang 16+
    • GCC 14+
    • MSVC (Visual Studio 2022)
  • Build System:
    • Ninja (recommended)
    • Make

⚠️ Note: C++ Modules support is still evolving.
Exact compiler and CMake versions matter, especially when mixing modules with testing and benchmarking.


▶️ Building

Using the helper script

./build.sh

Manual build (recommended)

cmake -S . -B build -G Ninja
cmake --build build

▶️ Running the Application

After a successful build, run the main executable:

./build/run_main

Example Output

Hello mcppdev
Hello module mcppdev

This confirms that:

  • The main executable was built correctly
  • The C++ module (cppmhello.cppm) was successfully compiled and imported

🧪 Running Tests

After building, run:

ctest --test-dir build

or

./build/run_tests

📊 Running Benchmarks

./build/run_benchmarks

📄 License

MIT

About

Simple Modern C++23 Development Project Skeleton

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published