![]() |
Quantify
An extensible C++ units library
|
Quantify's source code is composed of C++ modules and a header file containing some preprocessor macros. The best way to integrate Quantify into a project is with CMake by using FetchContent_Declare():
This will make the library available as the target quantify, which can then be linked against:
Only the main quantify target is exported. Documentation and tests are exported only if CMake is called from Quantify's root directory. This is true when building from source but not with FetchContent.
Some of the features of this library, such as custom units and unit scales, require the use of preprocessor macros. These can be found in Preprocessor Macros and can be included in any source file with:
import std;.If using CMake is not an option, the alternative is to manually copy the include/quantify/ directory into the projects path such that module dependency scanning can find Quantify modules.
Of course, this can be automated with tools such as GIT submodules, which will also make it easier to update later. In all cases, the compiler must be called such that it can find the module files. This is unfortunately not fully standardized yet within the C++ ecosystem and the instructions on how to do this may differ from one build environment to another.
While the main and dev tags can be used, the main tag being more stable. It is recommended to always pin a specific version such as v2.0.0.
Check the repository for the latest release version.
The versioning scheme for Quantify follows the following pattern:
This general idea is to follow the Semantic Versioning Specification.
The main reason for doing this is developing Quantify itself or its documentation. If intended for use as a dependency in another project, this is not necessary. For that see the Installation section above.
After cloning the repository, or otherwise getting a copy of the root directory, configure the library by running the following CMake command in the root directory:
Once the project is configured, the library can be built with the following command:
Doxygen documentation can be built with the following command:
This website will be built and placed in docs/build/html. Latex documentation and man pages are also generated and placed in docs/build.
Test files can be found in the test/ folder and can be built either all at once or separately:
test/common/ directory contains test infrastructure and not actual tests.