Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

demidko/native-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Native Library

A cross-platform C++20 native library template with dependency manager, powered by integration of CMake with Conan.

Usage

Make sure you are signed in to your GitHub account, then just click here to use template.

Features and benefits

  • 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.

Build

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.

Interop with Java

See JNR project

Containerization

We need Docker installed:

docker build . -t utility

After that, we can run the utility in the container (if needed):

docker run -it utility

Deploy

The sample configuration already exists in the .do directory. To deploy the application, just click the button.

Deploy to DigitalOcean

Conventions

  • 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 the src 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 from external linkage from others compilation units by adding them to the anonymous namespace or adding the keyword static.

About

Native C++ library template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages