A cross-platform C++20
native library template with dependency manager, powered by integration
of CMake
with Conan
.
Make sure you are signed in to your GitHub account, then just
click here
to use template.
- Full compatibility with existing technologies. No build configuration files are added except for the
traditional
CMakeLists.txt
. - Created projects are supported in
CLion
,Visual Studio
,VS Code
IDEs. - Dockerfile of executable container and GitHub actions CI already exists by default.
- Easy deploy to Digital Ocean.
- Adding dependencies right in CMakeLists.txt only.
- A project with all dependencies can be built on different OS without configuration changes.
We need CMake
build system and Conan
manager libraries.
Prepare the project for building in release mode:
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -B bin
Building together the application and tests:
cmake --build bin --target all
After that, the utility will appear in the bin
directory under the name lib
. The tests can be run by launching
the test
file located nearby.
See JNR project
We need Docker
installed:
docker build . -t utility
After that, we can run the utility in the container (if needed):
docker run -it utility
The sample configuration already exists in the .do
directory. To deploy the application, just click the button.
- The entry point must be located in the
Main.cpp
file for correct build script work. - To initialize resources, we using modern parameter passing by value, rather than a constant link.
- Only the result of the compilation of
* .cpp
files in thesrc
folder is included in the release assembly. - The
src
folder contains the*.cpp
and*.h
project files together. - The
test
folder contains the*.cpp
and*.h
project test files together. - Each
*.h
file must define only one entity in the global namespace, whose name must match the file name. - The contents of
*.cpp
files not declared in*.h
file must be protected fromexternal linkage
from others compilation units by adding them to the anonymous namespace or adding the keywordstatic
.