MarkWare VCMake is a comprehensive, modern C++ project template designed for cross-platform development in Visual Studio Code. The template provides a robust foundation for both standalone executables and libraries, incorporating industry best practices and modern build tools.
Just seconds away from starting π development in awesome C++ π»β¨
- Awesome OneClick Installer
- Linux, MacOS, Windows compatible
- Modern CMake with targets design
- Modern projects design Standalone & Library
- Conan 2 by conanfile.py
- CPM.cmake, CPM.license, cxxopt (cxxoptwiki)
- Sanitizers, Static Analysis, and Hardening
- Template Renamer
- Template Upgrader
- Counts with Cross-compilation
- Compatible to SSH, WSL remote development
- Automated Wrapper for CMake Build System by Tasks
- Native C++ debugging by Microsoft C++ extension
- CMake debugger
- GitHub Actions workflows for continuous integration
MWImGuiStarter
MWwxWidgetsStarter
MyPersonalDiscordBot
snake-in-shell-cpp
MassCode2Md
...
All these required tools are installed automatically if missing by the installer script.
- Visual Studio Code with C++ extension
- Python 3 (managed by Pyenv)
- Conan 2 for dependency management
- CMake (latest version 3 recommended)
- Code Formatters:
- Code analyzing:
This project provides a set of installer scripts in the .init
folder for setting up a development environment on various Linux distributions from scratch, including Debian-based systems, Fedora, Arch Linux, and OpenSUSE. Each script automates the installation of essential packages, tools, and configurations needed for development. Windows 10/11 and MacOS are also included.
# Debian based (Tested Debian Bookworm 12.9, Ubuntu 22.04)
curl -sSL https://raw.githubusercontent.com/tomasmark79/MarkWareVCMake/main/.init/DebianBasedInstaller.sh | bash
# Fedora (Tested Fedora 40, 41)
curl -sSL https://raw.githubusercontent.com/tomasmark79/MarkWareVCMake/main/.init/FedoraInstaller.sh | bash
# Arch (script in progress)
curl -sSL https://raw.githubusercontent.com/tomasmark79/MarkWareVCMake/main/.init/ArchInstaller.sh | bash
# OpenSUSE (script in progress)
curl -sSL https://raw.githubusercontent.com/tomasmark79/MarkWareVCMake/main/.init/OpenSUSEInstaller.sh | bash
# Windows 10/11 (script in progress)
powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/tomasmark79/MarkWareVCMake/main/.init/WindowsInstaller.ps1' -OutFile 'WindowsInstaller.ps1'; Set-ExecutionPolicy Bypass -Scope Process -Force; .\WindowsInstaller.ps1"
# MacOS (script in progress)
Shift+F7
: TASK MENU (standalone, library, both)F7
: π¨ Quick build StandaloneF5
: πͺ² Quick debug StandaloneCtrl+Alt+R
: just Launch Standalone binaryCtrl+Alt+L
: π clang-tidyCtrl+Alt+F
: π clang-formatCtrl+Alt+M
: π cmake-format
By Shift+F7
invoked TASK MENU includes the following automation commands:
- π Zero to Build means π§Ή π‘οΈ π§ π¨
- π¦Έ Zero to Hero means π§Ή π‘οΈ π§ π¨ π ποΈ
- π§Ή Clean build directories
- π‘οΈ Dependency installation with Conan 2
- π§ CMake configuration
- πͺ² CMake configuration with CMake π¦ debugger
- π¨ Build (Re-Build F7)
- π License collection with CPM for CPM
- π Install artefacts
- ποΈ Release tarballs
- πΈ Run CPack
- βοΈ Conan create library recipe
- π Conan dependencies in graph.html
- π CLang-tidy
- ππ CLang & CMake formatting
Supports multiple build types hardcoded in tasks.json
:
Debug, Release, RelWithDebInfo, MinSizeRel
Configurable CMake options for:
BUILD_SHARED_LIBS
, USE_STATIC_RUNTIME
, SANITIZE_ADDRESS
, SANITIZE_UNDEFINED
, SANITIZE_THREAD
, SANITIZE_MEMORY
, ENABLE_HARDENING
, ENABLE_IPO
, ENABLE_CCACHE
Build standalone part will also build library if linked in CMake configuration.
conan install "." --output-folder="./build/standalone/default/debug" --deployer=full_deploy --build=missing --profile default --settings build_type=Debug
source "./build/standalone/default/debug/conanbuild.sh" && cmake -S "./standalone" -B "./build/standalone/default/debug" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="./build/installation/default/debug"
source "./build/standalone/default/debug/conanbuild.sh" && cmake --build "./build/standalone/default/debug" -j 16
source "./build/standalone/default/debug/conanbuild.sh" && cmake --build "./build/standalone/default/debug" --target install -j 16
The template includes preconfigured menu items. The default Conan profile represents the default value in the buildArch definition. Other profiles can be edited and supplemented according to your existing Conan profiles.
{
/* ARCH ITEMS */
"id": "buildArch",
"type": "pickString",
"description": "Select target architecture",
"options": [
"default",
"x86_64-clang-linux-gnu",
"x86_64-w64-mingw32",
"aarch64-rpi4-linux-gnu"
],
"default": "default"
}
by python script SolutionRenamer.py
by pyton script SolutionUpgrader.py
in existing log file Solution.log
Template is using Two projects in One Solution.
MarkWareVCMake/
βββ include/
Contains library project public header files (.hpp) intended for use in other projects or modules.
MarkWareVCMake/
βββ src/
Contains library project source files (.cpp) and internal
header files (.hpp) that are not intended for public use.
MarkWareVCMake/
βββ standalone/
Contains just standalone project.
To avoid future issues with folder and file names, I have set these rules.
- All standard template folders, including those generated later, use lowercase letters only.
- User-defined folders can contain any combination of uppercase and lowercase letters.
- All C and C++ files provided in the template will use CamelCase convention, including an uppercase letter at the beginning.
C/C++ 2 spaces
Python 4 spaces
Q:
Build task error
Error: /home/.../Build/Standalone/default/Debug is not a directory
Error: /home/.../Build/Library/default/Debug is not a directory
A:
There is nothing to build. You must first create the configurations for the product, and only then can you compile separately with the build task. The "Zero to Build," "Zero to Hero," or CMake configuration tasks will help you create the configuration, which can then be compiled.
Q:
CMake-tidy error
Error while trying to load a compilation database: Could not auto-detect compilation database from directory, etc.
A:
For static code analysis to work correctly, you need to have the CMake configurations prepared. Also, ensure that the CMAKE_EXPORT_COMPILE_COMMANDS
variable is set to ON
in CMakeLists.txt.
xxd -i file.bin > file.h
To everyone who supported me in creating this template. These are various people and information from the web. Of course, also literature and courses that I have taken in the past. Various Discord servers and individuals who took a moment to make an indelible mark on this amazing work for me. Thank you very much!
dsdotname, littlemushroom
MIT License Copyright (c) 2024-2025 TomΓ‘Ε‘ Mark
This project is licensed under the MIT License. No warranty of functionality or liability is provided. If you use this project, please mention my credentials. If you need software and technical support, you can contact me.