WARNING: REPLACE WITH YOUR OWN README
Author: Martin Bauernschmitt
License: BSD 3-clause
This project is used to generate the base structure of a project automatically. It performs the following tasks:
- Generates module classes:
- Class header + source files
- Class unit test file
- Doxygen file for detailed module description
- Generates vscode configuration to debug application
- Generates version header to identify your project version via git
- Create a new folder with your project (e.g. francor_awesome)
- Initialize a empty repository inside the folder
git init - Copy the content of the template folder to the new project folder
- Config your project as described in the configuration section
- In VSCode press CTRL + B to show build tasks
- In VsCode press F5 to debug application
The version of your project is determined via git tags. If you want to tag your project with the version 1.0.2 (MAJOR.MINOR.PATCH) execute:
git tag -a v1.0.2 -m "Release 1.0.2"The next time you build your project the version information will be updated as followed:
/** \brief Major version number of project */
constexpr unsigned int VER_MAJOR = 1;
/** \brief Minor version number of project */
constexpr unsigned int VER_MINOR = 0;
/** \brief Patch version number of project */
constexpr unsigned int VER_PATCH = 2;If you work on a clean "tagged" project the
constexpr bool VER_RELEASE_BUILD = true;variable will be set to true. Otherwise it is set to false.
The project is organized as followed:
- .vscode/: Visual Studio Code settings and launch files
- cmake/: Template documents and helper functions for CMake
- docs/: Documentation generated by doxygen and docs added by user
- include/: Header files of module classes
- project_name/:
- module_name_1/:
- class_name_1.h
- class_name_2.h
- module_name_1/:
- project_name/:
- src/: Source files of module classes
- module_name_1/:
- class_name_1.cpp
- class_name_2.cpp
- main.cpp: Main application
- module_name_1/:
- tests/: GTest unit-tests
- module_name_1/:
- class_name_1_tests.cpp
- class_name_2_tests.cpp
- unit_tests.cpp
- module_name_1/:
- CMakeLists.txt: CMake file to config your project
Most of the folders and files are generated automatically by running cmake in the build directory.
You can config your project in the CMakeLists.txt via the following parameters:
# Project information
project(project_name) # Place here your project name (normally root folder name)
# Include functions
include(cmake/functions.cmake) # DO NOT EDIT
# Author information
set(COMPANY "Mustercompany") # Your company name
set(AUTHOR "Max Mustermann") # Your name
set(E_MAIL "max.mustermann@mustercompany.de") # E-Mail
# License information
set(LICENSE "BSD 3-clause") # License information
# Enable building version.h
set(GENERATE_VERSION_HEADER ON)You can add module classes with the command described below. Additional a detailed description is placed in the docs/ folder and a unit test file is generated.
# ---------------------------------------------------------
# Generator settings
# Set namespace
set(PROJECT_NS "project_name_ns")
# Generate class (Namespace, ModuleName, ClassName, Filename of class)
GENERATE_CLASS("${PROJECT_NS}" "my_module" "MyClass" "my_class")
# Generates:
# docs/details/can_details.dox
# include/project_name/can/can_interface.h
# src/can/can_interface.cpp
# tests/can/can_interface_tests.cpp
GENERATE_CLASS("${PROJECT_NS}" "can" "CANInterface" can_interface")The following tools shall be installed
# Build Tools
sudo apt install build-essential git cmake gdb libgtest-dev
# Install GTest
sudo apt install libgtest-dev
# Config GTest to be foundable
cd /usr/src/gtest
sudo mkdir build && cd build
sudo cmake ..
sudo make
sudo cp *.a /usr/lib
# Clangd for Code Analysis
sudo apt install clang-10 clang-format-10 clang-tidy-10 clangd-10
sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-10 10