Skip to content
/ MarkWareVCMake Public template

This solution represents a complete workflow for modern C/C++ software development. It integrates technologies such as VSCode, Conan, CMake, CPM.cmake, ModernCppStarter, TemplateRenamer, Formatters, and more into a single functional unit. It allows you to immediately create a standalone application or a library.

License

Notifications You must be signed in to change notification settings

tomasmark79/MarkWareVCMake

Repository files navigation

MarkWare VCMake Template 🎁

v0.0.4

Brief Description πŸ“‘

This solution represents a complete workflow for modern C/C++ software development. It integrates tools such as VSCode, Conan, CMake, CPM.cmake, ModernCppStarter, TemplateRenamer, Formatters, and more into a single functional unit. It allows you to create a Standalone Application and a library immediately.

My Goal 🎯

To create a project template for myself that is flexible, works out of the box, and saves me a lot of time.

The Result of my efforts πŸ§‘πŸ»β€πŸ’»

Is a modular and intelligently designed project structure that gives me enormous flexibility and decision-making power at every point on how the project will be configured. For others, it may take a while to get used to the project, but in return, you will be pleasantly surprised at how simple it actually is.

Deep Dive 🀿

VSCode

is an indispensable editor, ranking first due to its flexibility and configurability.

VSCode Tasks

are predefined tasks in Visual Studio Code that automate common development workflows, such as building, cleaning, and running your project. These tasks are defined in the tasks.json file and can be customized to fit your specific needs.

Conan 2

is a powerful dependency manager for C/C++ projects. It simplifies the process of adding and managing libraries that your project may need. With Conan 2, you can easily specify the dependencies in a conanfile.txt or conanfile.py, and it will handle the downloading, building, and integrating of these libraries into your project. This ensures that you always have the correct versions of the libraries and that they are configured properly for your development environment. Conan 2 also supports package creation, allowing you to create and share your own libraries with others.

CMake

as a modern configurator with object-oriented elements, provides enormous flexibility.

CPM.cmake

add simplified support for fetching packages from GitHub, ensuring an easier way to obtain such packages.

CPM.Licenses

also helps in managing and writing license files for the dependencies used in the project.

ModernCppStarter

is a project structure proven over many years and projects for developing programs and libraries. The essence of this structure is also embedded in this project.

TemplateRenamer

is a script that allows you to rename the template project to your desired names for both the library and the standalone application. This ensures that the project is uniquely identified and tailored to your specific needs.

Formatters

are simple scripts that quickly reformat C/C++ and CMake files.

List of dependencies πŸ”ƒ

Quick Start πŸ’£

WMVCMake.with.subtitles.mp4
# clone 
git clone https://github.com/tomasmark79/MarkWareVCMake ./NameOfMyAwesomeApp
cd NameOfMyAwesomeApp/
code .

Integrated VSCode tasks

{
            "id": "taskName",
            "type": "pickString",
            "description": "Select task",
            "options": [
                "Build πŸ”¨", /* Both πŸ‘‡ */
                "Rebuild πŸ§Ήβš”οΈβš™οΈπŸ”¨",
                " ",
                "Configure βš™οΈ",
                "Conan βš”οΈ",
                "Clean 🧹",
                "Install πŸ“Œ",
                "Licenses πŸ“œ",
                " ",
                "Build Standalone", /* Only Standalone πŸ‘‡ */
                "Rebuild Standalone",
                "Configure Standalone",
                "Conan Standalone",
                "Clean Standalone",
                "Install Standalone",
                "Licenses Standalone",
                " ",
                "Build Library", /* Only Library  πŸ‘‡*/
                "Rebuild Library",
                "Configure Library",
                "Conan Library",
                "Clean Library",
                "Install Library",
                "Licenses Library",
            ],
            "default": "Build πŸ”¨"
}

Project filesystem structure description

tree -a --prune -I '.git|Build|Hidden'
.
β”œβ”€β”€ .clang-format - configuration file for clang-format, a tool to format C/C++/Objective-C/...
β”œβ”€β”€ cmake - directory containing CMake-related scripts and modules
β”‚Β Β  β”œβ”€β”€ CPM.cmake - is a cross-platform CMake script that adds dependency management capabilities to CMake
β”‚Β Β  β”œβ”€β”€ Modules - directory for custom CMake modules
β”‚Β Β  β”‚Β Β  └── FindX11.cmake - custom CMake module to find X11 libraries
β”‚Β Β  └── tools.cmake - CMake script for additional tools and utilities
β”œβ”€β”€ CMakeController.sh - shell script to control CMake build process
β”œβ”€β”€ .cmake-format - configuration file for cmake-format, a tool to format CMake scripts
β”œβ”€β”€ CMakeLists.txt - main CMake build script for library
β”œβ”€β”€ CMakeUserPresets.json - JSON file containing user presets for CMake
β”œβ”€β”€ conanfile.txt - Conan package manager configuration file
β”œβ”€β”€ .gitattributes - Git configuration file for defining attributes per path
β”œβ”€β”€ .gitignore - Git configuration file to specify untracked files to ignore
β”œβ”€β”€ include - directory containing header files
β”‚Β Β  └── VCMLib - directory for VCMLib library headers
β”‚Β Β      └── VCMLib.hpp - header file for VCMLib library
β”œβ”€β”€ LICENSE - license file for the project
β”œβ”€β”€ .python-version - file specifying the Python version for the project
β”œβ”€β”€ README.md - markdown file containing the project documentation
β”œβ”€β”€ Source - directory containing source files
β”‚Β Β  └── VCMLib.cpp - source file for VCMLib library
β”œβ”€β”€ Standalone - directory for standalone application
β”‚Β Β  β”œβ”€β”€ CMakeLists.txt - CMake build script for standalone application
β”‚Β Β  β”œβ”€β”€ LICENSE - license file for standalone application
β”‚Β Β  └── Source - directory containing source files for standalone application
β”‚Β Β      └── Main.cpp - main source file for standalone application
β”œβ”€β”€ TemplateRenamer.sh - shell script to rename names for standalone and library
└── .vscode - directory containing Visual Studio Code configuration files
β”œβ”€β”€ c_cpp_properties.json - VSCode configuration file for C/C++ properties
β”œβ”€β”€ keybindings.json - VSCode configuration file for custom keybindings
β”œβ”€β”€ launch.json - VSCode configuration file for debugging settings
β”œβ”€β”€ settings.json - VSCode configuration file for workspace settings
└── tasks.json - VSCode configuration file for defining tasks
Useful to Know

└── TemplateRenamer.sh

This shell script is a very powerful renamer for the entire project. After cloning the repository into your folder, you can use this script to create your own names for both the library and the application. The names must not be the same.

Usage: ./TemplateRenamer.sh <old_lib_name> <new_lib_name> <old_standalone_name> <new_standalone_name>

ToDo

I still want to add:

  • 🚧 add installation CMake configuration
  • prepare list of commands for CLI-only workflow
  • port to MS Windows family OS
  • include some other features useful for developers

My Code Codex

I use capital letters at the beginning of words for naming all new folders and files.
One exception: No capital letter in the "include" folder is intentional!

I drew inspiration from the following projects

Thanks to Sleepy Monax for Mac OS feedback.


About Me πŸ§‘πŸ»β€πŸ’»

"The result of a lot of hours of incredible work. Time seemed to stand still. The outcome is a template that takes C++ development to a whole new level.

"Buy me a coffee β˜•πŸ΅ or spare some time. πŸ™‚"

paypal.me/TomasMark
Bitcoin: 3JMZR6SQo65kLAxxxXKrVE7nBKrixbPgSZ
Ethereum: 0x7a6C564004EdecFf8DD9EAd8bD4Bbc5D2720BeE7

MIT License

Copyright (c) 2024 TomΓ‘Ε‘ Mark

About

This solution represents a complete workflow for modern C/C++ software development. It integrates technologies such as VSCode, Conan, CMake, CPM.cmake, ModernCppStarter, TemplateRenamer, Formatters, and more into a single functional unit. It allows you to immediately create a standalone application or a library.

Topics

Resources

License

Stars

Watchers

Forks