Production-ready C++ starter focused on fast iteration, keyboardβdriven workflows in VSCode, crossβplatform + WebAssembly targets, and automated, reproducible build tooling (CMake + Conan 2 + presets + scripted orchestration). Built to eliminate friction from adβhoc shell commands and fragile IDE integrations.
Quick start:
Shift+F7
β "π¦Έ Zero to Hero" (configure, build, test, package). Then useF7
(rebuild) andF5
(debug).
- π Overview
- β¨οΈ VSCode Keyboard Workflow (Primary)
- β¨ Key Features
- β‘ Quick Start
- π§ Build System & Configuration (Comprehensive Guide)
- π οΈ Prerequisites & Dependencies
- ποΈ Project Structure
- π¦ Package Management
- π§° Development Tools
- π Cross-Platform Development
- π WebAssembly & Emscripten
- π§ͺ Testing Framework
- π Library Development
- π CI/CD Pipeline
- π οΈ Maintenance & Utilities
- π Documentation
- π License
DotNameCpp is an opinionated template: everything (configure, build, test, format, coverage, docs, package, wasm serve) is triggered by VSCode keyboard shortcuts and task menusβno dependency on the official CMake VSCode extensions. Btw, CMake extensions is still supported. This yields a deterministic experience across Linux / macOS / Windows / Emscripten and reduces cognitive load.
- Keyboardβfirst workflow (no remembering long commands)
- Unified automation via
SolutionController.py
(CI mirrors local) - Modern CMake presets + Conan 2 + optional cross / wasm profiles
- Builtβin quality: clang-format, clang-tidy, coverage, Doxygen
- Dual target: reusable library + standalone app
- Crossβplatform (native + wasm) with consistent task semantics
Prefer predictable scripted orchestration over fragile IDE state. Keep the developer in flow: one shortcut β structured task chain. Advanced details (toolchain flags, dependency install, coverage setup) live in automation so dayβtoβday work stays simple.
Copy .vscode/keybindings.json
into your user settings once (if not already). Then:
Shift+F7
β Build Menu (first: "π¦Έ Zero to Hero")F7
Rebuild Β·F5
Debug Β·Ctrl+Alt+R
RunCtrl+F7
Utilities (format / lint / docs / coverage)Ctrl+Alt+E
Emscripten serve Β· Coverage:Ctrl+Alt+Shift+H
Keyboard-first development: every major action = shortcut β menu β deterministic scripted sequence.
Shortcut | Action | Description |
---|---|---|
F5 | Quick Debug | Start debugging standalone application |
F7 | Quick Build | Build standalone application (default Debug) |
Shift+F7 | π¨ Build Menu | PRIMARY BUILD WORKFLOW - Access all build tasks |
Ctrl+F7 | π οΈ Other Tasks | Utilities, formatting, documentation, coverage |
Ctrl+Alt+R | Run Standalone | Execute the built standalone binary |
Ctrl+Alt+E | Launch Emscripten | Build and serve WebAssembly version |
The primary development workflow - this menu contains all essential build operations:
- π Zero to Build: Complete clean build workflow
- π¦Έ Zero to Hero: Full development cycle (build, test, package)
- π‘οΈ Conan Install: Install/update dependencies
- π§ CMake Configure: Configure build system
- π CMake configure with Coverage: Configure with code coverage
- π¨ Build: Compile the project
- π§ͺ Run CTest: Execute test suite
- π§Ή Clean selected folder: Clean build artifacts
- π Install built components: Install built components
- ποΈ Create Tarballs: Package for distribution
Secondary workflow for code quality and maintenance:
- π Format Code: Apply clang-format to all C++ files
- π Format CMake: Format all CMake files
- π clang-tidy linting: Run static analysis
- π Generate Documentation: Create Doxygen docs
- π Coverage Tasks: Quick access to coverage analysis
- π§ Build All CMakeUserPresets.json: Build all presets
Shortcut | Action | Description |
---|---|---|
Ctrl+Alt+F | Format Code | Run clang-format on current file |
Ctrl+Alt+L | Lint Code | Run clang-tidy analysis |
Ctrl+Alt+M | Format CMake | Run cmake-format on CMake files |
Shortcut | Action | Description |
---|---|---|
Ctrl+Alt+Shift+C | Configure with Coverage | Configure build with coverage enabled |
Ctrl+Alt+Shift+H | Coverage HTML Report | Generate and open HTML coverage report |
Ctrl+Alt+Shift+F | Coverage Full Report | Generate both HTML and XML coverage reports |
Ctrl+Alt+Shift+T | Coverage Tasks Menu | Show detailed coverage task options |
Ctrl+Alt+Shift+O | Quick Coverage Tasks | Fast access to coverage tasks (native only) |
- First run:
Shift+F7
β "π¦Έ Zero to Hero" (installs, configures, builds, tests, packages) - Iterate:
F7
build βF5
debug β edit β repeat - Quality:
Ctrl+F7
utilities (format / tidy / docs) - Tests:
Shift+F7
β "π§ͺ Run CTest" - Coverage (native default only):
Ctrl+Alt+Shift+H
- Shortcuts configurable via
.vscode/keybindings.json
- Works identically across Linux / macOS / Windows (and wasm where applicable)
- CMake 3.31+ with modern preset system
- Conan 2.0 integration for dependency management
- Ninja build system for fast compilation
- ccache support for accelerated rebuilds
- Cross-compilation ready with toolchain support
- Native Development: Linux, macOS, Windows
- WebAssembly: Emscripten integration for web deployment
- Cross-Compilation: ARM, x86, x64 architectures, etc.
- Static Analysis: clang-tidy with comprehensive rule sets
- Code Formatting: clang-format and cmake-format
- Documentation: Doxygen with automated generation
- Testing: Google Test framework integration
- Debugging: GDB/LLDB/CMake support with VSCode integration
- Parallel Computing: TBB - Threading Building Blocks
- Dual Structure: Library and standalone application support
- Modular Architecture: Reusable components and utilities
- Asset Management: Integrated resource handling system
- Licensing: Built-in license collection and management
- GitHub Actions: Multi-platform CI/CD pipelines
- Automated Testing: Unit tests, integration tests, and benchmarks
- Release Management: Automated packaging and distribution
- Quality Gates: Static analysis and code coverage integration
Open in VSCode and use keyboard shortcuts for the best development experience:
Shift+F7 β "π¦Έ Zero to Hero" # Complete setup, build, test, and package
F7 # Quick rebuild
F5 # Start debugging
git clone git@github.com:tomasmark79/DotNameCpp.git
add this function to your .bashrc
or .zshrc
:
clonedotname() {
local PN="${1:-AppName}"
git clone git@github.com:tomasmark79/DotNameCpp.git "$PN" && rm -rf "$PN/.git" && cd "$PN"
python SolutionRenamer.py DotNameLib "$PN"Lib DotNameStandalone "$PN"Standalone
}
Then simply use:
clonedotname # Clone with default name "AppName"
clonedotname MyCustomAppName # Clone with custom name
pip install conan
conan profile detect
# Use the Python controller for advanced options - callable from VSCode tasks
python SolutionController.py standalone "π‘οΈ Conan install" default Debug
python SolutionController.py standalone "π§ CMake configure" default Debug
python SolutionController.py standalone "π¨ Build" default Debug
Click the Code button on GitHub β Codespaces β Create codespace for instant cloud development environment.
Tool | Minimum Version | Purpose | Installation |
---|---|---|---|
Git | 2.25+ | Version control | Download |
CMake | 3.31+ | Build system | Download |
Conan | 2.0+ | Package manager | pip install conan |
Python | 3.8+ | Automation scripts | Download |
Ninja | 1.10+ | Build tool | Download |
Tool | Purpose | Installation |
---|---|---|
ccache | Compilation cache | Download |
clang-tidy | Static analysis | Part of LLVM |
clang-format | Code formatting | Part of LLVM |
cmake-format | CMake formatting | pip install cmake-format |
Doxygen | Documentation | Download |
gcovr | Code coverage | pip install gcovr |
TBB | Parallel computing (Linux) | sudo dnf install tbb-devel (Fedora), sudo apt install libtbb-dev (Ubuntu) |
Platform | Compilers | Versions |
---|---|---|
Linux | GCC, Clang | GCC 11+, Clang 14+ |
macOS | Clang, GCC | Xcode 14+, GCC 11+ |
Windows | MSVC, Clang, GCC | VS 2022, Clang 14+, MinGW 11+ |
Emscripten | emcc | 3.1.0+ |
π DotNameCpp/
βββ π .github/ # GitHub workflow files
βββ π .vscode/ # Visual Studio Code configuration
βββ π assets/ # Project resources
β βββ customstrings.json # Localization strings
β βββ DotNameCppLogo.svg # Project logo
β βββ ems-mini.html # Emscripten template
βββ π build/ # Build outputs (auto-generated)
β βββ π installation/ # Installation artifacts
β βββ π standalone/ # Standalone builds
β βββ π tarballs/ # Distribution packages
βββ π cmake/ # CMake modules and utilities
β βββ project-common.cmake # Common project settings
β βββ project-library.cmake # Library-specific configuration
β βββ project-standalone.cmake # Standalone app configuration
β βββ tmplt-*.cmake # Feature modules (sanitizers, hardening, etc.)
β βββ π modules/ # Custom CMake modules
βββ π doc/ # Documentation (auto-generated)
βββ π include/DotNameLib/ # Public library headers
βββ π src/ # Library source code
β βββ DotNameLib.cpp # Main library implementation
β βββ π Assets/ # Asset management utilities
β βββ π Logger/ # Logging functionality
β βββ π Utils/ # Utility classes
βββ π standalone/ # Standalone application
β βββ π src/ # Application source
β βββ π tests/ # Application tests
βββ π CMakeLists.txt # Root CMake configuration
βββ π CMakeUserPresets.json # CMake presets for different configurations
βββ π conantools.py # Conan integration utilities
βββ π conanfile.py # Conan dependency specification
βββ π SolutionController.py # Main Template automation script
βββ π SolutionRenamer.py # Template renaming utility
βββ π SolutionUpgrader.py # Template update utility
This section provides complete build configuration options for all development scenarios, from beginner-friendly VSCode workflow to advanced command-line usage.
Primary approach using the keyboard shortcuts described above:
Shift+F7 β "π¦Έ Zero to Hero" # Complete setup, build, test, package
F7 # Quick rebuild
F5 # Debug mode
Ctrl+Alt+R # Run application
Automated workflow using the Python controller script:
Normally, you won't need to run these commands manually, since all actions are available through keyboard shortcuts in VSCode.
# Complete development cycle
python SolutionController.py both "π¦Έ Zero to Hero" default Debug
# Step-by-step build process
python SolutionController.py standalone "π‘οΈ Conan install" default Debug
python SolutionController.py standalone "π§ CMake configure" default Debug
python SolutionController.py standalone "π¨ Build" default Debug
python SolutionController.py standalone "π§ͺ Run CTest" default Debug
# Cross-platform builds
python SolutionController.py standalone "π¨ Build" emscripten Release
python SolutionController.py standalone "π¨ Build" x86_64_w64_mingw32 Release
# Code coverage workflow
python SolutionController.py standalone "π Configure with Coverage" default Debug
python SolutionController.py standalone "π¨ Build" default Debug
python SolutionController.py standalone "π§ͺ Run CTest" default Debug
python SolutionController.py standalone "π Coverage HTML Report" default Debug
# Development tools
python SolutionController.py both "π Format Code" noNeedArch
python SolutionController.py both "π clang-tidy linting" default Debug
python SolutionController.py both "π Generate Documentation" noNeedArch
Direct CMake for integration with existing build systems:
# Quick start (recommended for simple cases)
conan install . --output-folder="build/" --build=missing --deployer=full_deploy -s build_type=Debug
cmake --preset generic-linux-x86_64-gcc-15-debug -DBUILD_LIBRARY=ON -DBUILD_STANDALONE=ON
cmake --build build/ -j $(nproc)
# Advanced CMake with presets
cmake --list-presets # List available presets
cmake --preset debug-linux-x86_64-gcc-15 # Configure with preset
cmake --build --preset debug-linux-x86_64-gcc-15 # Build with preset
ctest --preset debug-linux-x86_64-gcc-15 # Test with preset
# Manual CMake configuration (not recommended)
mkdir build && cd build
conan install .. --build=missing
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_LIBRARY=ON -DBUILD_STANDALONE=ON
make -j $(nproc)
Important: Always specify the build type (-s build_type=Debug
or -s build_type=Release
) with Conan install, and prefer generated CMake presets over manual configuration.
Configure your build with these CMake options:
option(ENABLE_GTESTS "Build and run unit tests" ON)
option(ENABLE_CCACHE "Use ccache compiler cache" ON)
option(BUILD_SHARED_LIBS "Build shared (.so) libraries" OFF)
option(USE_STATIC_RUNTIME "Link C++ runtime statically" OFF)
option(ENABLE_IPO "Enable link-time optimization" OFF)
option(ENABLE_HARDENING "Enable security hardening" OFF)
option(ENABLE_COVERAGE "Enable code coverage analysis" OFF)
option(SANITIZE_ADDRESS "Enable address sanitizer" OFF)
option(SANITIZE_UNDEFINED "Enable undefined behavior sanitizer" OFF)
option(SANITIZE_THREAD "Enable thread sanitizer" OFF)
option(SANITIZE_MEMORY "Enable memory sanitizer" OFF)
β οΈ Coverage Limitation: Coverage is supported only for nativedefault
builds (locally runnable). Cross targets (Emscripten, MinGW, ARM, etc.) are buildβonly in this workflow; tests & coverage skipped.
- Start with VSCode shortcuts for the best development experience
- Use Python SolutionController for automation and CI/CD
- Fall back to pure CMake for integration with existing systems
- Always specify build types with Conan to ensure proper linking
- Use presets instead of manual CMake configuration
- Native builds only for code coverage analysis
This template uses Conan 2.0 for modern, efficient dependency management:
# conanfile.py excerpt
def requirements(self):
# Core dependencies
self.requires("fmt/10.1.1")
The only thing you need to do to use Conan in your environment is to install Conan and create a profile for your compiler.
The template automates everything you need. However, it's useful to know the basic commands for working with Conan. Find the official documentation at Conan Documentation.
For clang-tidy linting must exist build artifacts due to the nature of the analysis.
Keyboard shortcut: Ctrl+Alt+L
For clang-format and cmake-format, no build artifacts are needed. Keyboard shortcuts:
Ctrl+Alt+F
(C++),Ctrl+Alt+M
(CMake)
Feature | Linux | macOS | Windows | WebAssembly |
---|---|---|---|---|
Native Build | β | β | β | N/A |
Cross-Compilation | β | β | β | β |
Package Management | β | β | β | β |
IDE Integration | β | β | β | β |
CI/CD | β | β | β | β |
π parallel computing support note: For full parallel computing support, install TBB development package:
sudo apt install libtbb-dev
(Ubuntu/Debian) orsudo dnf install tbb-devel
(Fedora/RHEL)
Just like with native compilation, the best approach is to use VSCode keyboard shortcuts. However, if you need to use the command line, here are the basic commands:
# ARM64 Linux from x86_64
conan install . -pr:h=profiles/arm64-linux -pr:b=default
# Windows from Linux
conan install . -pr:h=profiles/windows-x64 -pr:b=default
# Configure cross-compilation
cmake --preset cross-arm64-release
This template provides seamless WebAssembly development with Emscripten. Simply use a Conan profile configured for your environment.
Experience the template in action:
- Debug Version: DotNameStandalone.html (Debug)
- Release Version: DotNameStandalone.html (Release)
Experience with more complex scenarios: GPU required
- Debug Version: DotNameStandalone.html (Debug)
- Release Version: DotNameStandalone.html (Release)
Use the keyboard shortcut to build and serve the WebAssembly application locally:
Keyboard shortcut: Ctrl+Alt+E
Comprehensive testing framework with Google Test:
// Example test (standalone/tests/)
#include <gtest/gtest.h>
#include "DotNameLib/DotNameLib.hpp"
TEST(DotNameLibTest, Initialization) {
EXPECT_TRUE(DotNameLib::isInitialized());
EXPECT_EQ(DotNameLib::getVersion(), "0.0.1"); // sync with cmake/project-library.cmake
}
The template supports both header-only and compiled library development:
// include/DotNameLib/DotNameLib.hpp
#pragma once
namespace DotNameLib {
// Public API
bool initialize();
void shutdown();
std::string getVersion();
}
// src/DotNameLib.cpp
#include "DotNameLib/DotNameLib.hpp"
namespace DotNameLib {
bool initialize() {
// Implementation
return true;
}
}
- project called Wheels using DotNameCpp and pushed to GitHub
- Then, in next project named Car, using the Wheels library as follows
In project Car in file project-standalone.cmake:
CPMAddPackage("gh:tomasmark79/Wheels#main")
target_link_libraries(${STANDALONE_NAME} PRIVATE WheelsLib)
In project Car in file project-tests.cmake:
target_link_libraries(${TEST_NAME} PRIVATE WheelsLib)
In project Car in file AppCore.hpp create instance of the library:
#include <WheelsLib/WheelsLib.hpp>
std::unique_ptr<dotname::WheelsLib> uniqueWheelsLib;
uniqueWheelsLib = std::make_unique<dotname::WheelsLib> (AppContext::assetsPath);
LOG_I_STREAM << "Wheels count: " << uniqueWheelsLib->getWheelsCount() << std::endl;
include(FetchContent)
FetchContent_Declare(
Wheels
GIT_REPOSITORY https://github.com/tomasmark79/Wheels.git
GIT_TAG v1.0.0
)
FetchContent_MakeAvailable(Wheels)
target_link_libraries(your_target Wheels::Wheels)
# In consumer project's conanfile.py
def requirements(self):
self.requires("dotnamelib/1.0.0")
find_package(Wheels REQUIRED)
target_link_libraries(your_target Wheels::Wheels)
add_subdirectory(path/to/Wheels)
target_link_libraries(your_target Wheels::Wheels)
The main versioning for libraries is maintained in the project definition file at cmake/project-library.cmake
.
project(
${LIBRARY_NAME}
VERSION 0.0.1
LANGUAGES C CXX
DESCRIPTION "template Copyright (c) 2024 TomasMark [at] digitalspace.name"
HOMEPAGE_URL "https://github.com/tomasmark79/DotNameCpp")
Comprehensive CI/CD with multi-platform support:
Implemented Workflows:
- β Linux CI: Ubuntu with GCC and Clang
- β macOS CI: Latest macOS with Xcode
- β Windows CI: Windows Server with MSVC
- β Emscripten CI: WebAssembly builds and tests
Badge Status: See repository badges at the top (linux.yml Β· macos.yml Β· windows.yml Β· emscripten.yml)
Rename your project from the template:
python SolutionRenamer.py DotNameLib MyAwesomeLib DotNameStandalone MyAwesomeApp
python SolutionRenamer.py MyAwesomeLib DotNameLib MyAwesomeApp DotNameStandalone
Affected files: Check source code for the complete list.
Update template files from the upstream repository:
python SolutionUpgrader.py
Central automation hub for all build and development tasks:
# Interactive usage - Use VSCode tasks for full functionality
python SolutionController.py
# Command line usage
python SolutionController.py <product> "<task>" <architecture> [build_type]
# Examples:
python SolutionController.py standalone "π¨ Build" default Debug
python SolutionController.py both "π¦Έ Zero to Hero" default Release
python SolutionController.py emscripten "π Launch Emscripten Server" noNeedArch
# Note: Help system documentation is in development
Automatic documentation generation with Doxygen:
Keyboard shortcut: Ctrl+F7
β "π Generate Documentation"
MIT License
Copyright (c) 2024β2025 TomΓ‘Ε‘ Mark
This template is provided "as is" without warranties of any kind. While extensively tested across multiple platforms and continuously maintained, users must validate that the template meets their specific requirements before production use. The template undergoes regular updates to maintain compatibility with evolving toolchains and dependencies.
Key Considerations:
- Verify all dependencies and tools are compatible with your target environment
- Test thoroughly in your specific development and deployment scenarios
- Some features (marked as TODO) are planned but not yet implemented
- Cross-platform builds may require additional configuration on certain systems
Happy coding! π
For support, questions, or suggestions, please open an issue or start a discussion.
- Coverage: native
default
architecture only. - Cross / wasm builds: build + (where applicable) run; no local coverage.
- Conan package publishing example is planned.
- Ensure clean git state before running renamer / upgrader scripts (easy rollback).
- Emscripten requires an appropriate Conan profile (not auto-installed).