A basic C++ library template utilizing CMake and Conan.
- π£ Dependency management with Conan
- π Build configuration with CMake
- π§© Automatic publishing of artifacts to Artifactory with Github Actions
- π Automatic publishing of Doxygen documentation with Github Actions
- π Preconfigured for Unit-Testing with Catch2
To use this library in you project, you can install it in the following ways:
# Add artifactory repository as remote:
conan remote add jothepro-conan-public https://jothepro.jfrog.io/artifactory/api/conan/conan-public
# Install a release of `mylibrary`
conan install --remote jothepro-conan-public mylibrary/0.1.7@jothepro/stableIf you don't want to build & run tests when building from source, set the CONAN_RUN_TESTS variable:
install --remote jothepro-conan-public mylibrary/0.1.7@jothepro/stable -e CONAN_RUN_TESTS=0Pre-Releases are available in the beta channel:
conan install --remote jothepro-conan-public mylibrary/0.1.8@jothepro/beta- Conan >= 1.30
- CMake >= 3.15
- Doxygen 1.9.1 (optional)
- Commandline:
# Create build folder for out-of-source build mkdir build && cd build # Install Dependencies with Conan conan install .. # Configure, Build & Test conan build ..
- Clion: Install the Conan Plugin before configuring & building the project as usual.
This template uses Catch2 for testing. The Unit-tests are defined in test.
- Commandline: To run just the unit-tests, you can run
conan build .. --test. - CLion: Execute the
MyLibraryTesttarget
This template uses Doxygen for documenation.
To generate the docs, run doxygen Doxyfile or execute the doxygen target defined in the CMakeLists.txt.
This template uses Github Actions for automating the release of a new library version.
- The workflow
configureBuildTestCreateAndUpload.yamlconfigures, builds, tests the library automatically on each push. When a new release is created in Github, the resulting artifact is automatically uploaded to a public artifactory repository - The workflow
publish-pages.yamlautomatically builds and publishes the documentation to Github Pages when a new release is created in Github.
.
βββ CMakeLists.txt (1)
βββ Doxyfile (2)
βββ LICENSE (3)
βββ README.md (4)
βββ conanfile.py (5)
βββ docs (6)
β βββ doxygen-awesome-css (7)
β βββ doxygen-custom (8)
β β βββ ...
β βββ example-page.dox (9)
β βββ img (10)
β βββ ...
βββ lib (11)
β βββ CMakeLists.txt (12)
β βββ src (13)
β β βββ example.cpp (14)
β βββ include (15)
β βββ MyLibrary (16)
β βββ example.hpp (17)
βββ test (18)
β βββ CMakeLists.txt (19)
β βββ mylibrarytest.cpp (20)
βββ test_package (21)
βββ CMakeLists.txt (22)
βββ conanfile.py (23)
βββ example.cpp (24)
- Root
CMakeLists.txt. Includes Library Sources (11) and unit tests (18). - Doxyfile for documentation generation.
CMakeLists.txt(1) defines a targetdoxygento build the documentation. - License file.
- The Readme you currently read.
- Conanfile. Used to install dependencies & publishing the package.
- Documentation subdirectory. Generated docs will pe placed under
docs/html. - Submodule containing the custom-css for doxygen.
- Project-specific doxygen customizations.
- Example documentation file. All
.doxfiles in this dir will be automatically included in the documentation. - Images for documentation.
- Library sources folder.
CMakeLists.txtfor library.- Source files folder.
- Private source file.
- Public headers folder.
- Library namespace.
- Public header file example.
- Unit tests folder.
CMakeLists.txtthat defines unit tests.- Example unit test file.
- Conan linking test directory.
- CMakeLists.txt that defines an example project that links the library.
- Conanfile that defines linking test.
- Example sources that require the library to build & run successfully.
This template is inspired by these talks: