v0.0.4
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.
To create a project template for myself that is flexible, works out of the box, and saves me a lot of time.
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.
is an indispensable editor, ranking first due to its flexibility and configurability.
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.
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.
as a modern configurator with object-oriented elements, provides enormous flexibility.
add simplified support for fetching packages from GitHub, ensuring an easier way to obtain such packages.
also helps in managing and writing license files for the dependencies used in the project.
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.
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.
are simple scripts that quickly reformat C/C++ and CMake files.
- Linux π§ or Mac
- VSCode - https://code.visualstudio.com (mandatory)
- CMake - https://cmake.org/download/ (mandatory)
- Python3 - https://www.python.org/downloads/ (mandatory)
- Conan2 Configurator - https://docs.conan.io/2/installation.html (mandatory)
- Compilers - https://gcc.gnu.org, https://clang.llvm.org, ... (mandatory)
- Cmake-formatter - https://cmake-format.readthedocs.io/en/latest/ (optional)
- Clang-formatter - https://clang.llvm.org/docs/ClangFormat.html (optional)
- Cross-compiler with a toolchain and a sysroot - https://crosstool-ng.github.io (optional)
# clone
git clone https://github.com/tomasmark79/MarkWareVCMake ./NameOfMyAwesomeApp
cd NameOfMyAwesomeApp/
code .
{
"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 π¨"
}
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
βββ 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>
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
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!
Thanks to Sleepy Monax for Mac OS feedback.
"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