- Notifications
You must be signed in to change notification settings - Fork12
Single-header libraries from the Magnum engine
License
mosra/magnum-singles
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository contains single-header libraries from the Magnum engine.
- Project homepage —https://magnum.graphics/
- Documentation —https://doc.magnum.graphics/
- GitHub project page —https://github.com/mosra/magnum-singles
There are the following single-header libraries at the moment. This list willgrow with more Magnum features being exposed this way.
Library | LoC | PpLoC[1] | Description |
---|---|---|---|
CorradeArrayView.h | 923 | 2013 | Containers::ArrayView andContainers::StaticArrayView, lightweight alternatives tostd::span |
CorradeStridedArrayView.h | 1359[2] | 2876 | Containers::StridedArrayView, multi-dimensional strided array view. Depends onCorradeArrayView.h . |
CorradeArray.h | 1067[2] | 2715 | Containers::Array andContainers::StaticArray, lightweight alternatives tostd::vector andstd::array . Depends onCorradeArrayView.h . |
CorradeGrowableArray.h | 1126[2] | 4334 | Growable APIs forContainers::Array. Depends onCorradeArray.h . |
CorradeEnumSet.h | 265 | 1688 | Containers::EnumSet, a type-safe set of bits |
CorradeFunction.h | 505 | 1907 | Containers::Function, a lightweight alternative tostd::function |
CorradeOptional.h | 458 | 1863 | Containers::Optional, a lightweight alternative tostd::optional |
CorradePair.h | 432 | 1729 | Containers::Pair, a lightweight alternative tostd::pair |
CorradePointer.h | 381 | 1769 | Containers::Pointer, a lightweight alternative tostd::unique_ptr |
CorradeReference.h | 131 | 1613 | Containers::Reference, a lightweight alternative tostd::reference_wrapper |
CorradeScopeGuard.h | 263 | 1689 | Containers::ScopeGuard, a lightweight alternative tostd::unique_ptr with a custom deleter |
CorradeString.hpp | 2521[2] | 2179 | Containers::String andContainers::StringView, lightweight and optimized string (view) classes. Depends onCorradeEnumSet.h , the implementation depends onCorradeCpu.hpp . |
CorradeTriple.h | 476 | 1746 | Containers::Triple, a lightweight alternative to a three-componentstd::tuple |
CorradeCpu.hpp | 1730 | 1978 | Cpu library, compile-time and runtime CPU feature detection and dispatch |
CorradeStlForwardArray.h | 88 | 99[3] | Corrade's forward declaration forstd::array , a lightweight alternative to the full<array> (15k PpLOC[1]) where supported |
CorradeStlForwardString.h | 89 | 92 | Corrade's forward declaration forstd::string , a lightweight alternative to the full<string> (11k PpLOC[1]) where supported |
CorradeStlForwardTuple.h | 102 | 2231 | Corrade's forward declaration forstd::tuple , a lightweight alternative to the full<tuple> (13k PpLOC[1]) where supported |
CorradeStlForwardVector.h | 81 | 181[3] | Corrade's forward declaration forstd::vector , a lightweight alternative to the full<vector> (9k PpLOC[1]) where supported |
CorradeStlMath.h | 73 | 3301[4] | Corrade's optimized<cmath> , without the heavy C++17 additions (which is otherwise 11k PpLOC[4]) |
MagnumMath.hpp | 8388[2] | 9812 | Math namespace, a full-featured graphics-oriented linear algebra library. Depends onCorradePair.h . |
MagnumMathBatch.hpp | 1318[2] | 11185 | Math namespace, batch APIs. The implementation depends onCorradeStridedArrayView.h andMagnumMath.hpp . |
MagnumMeshTools.hpp | 765[2] | 283 | MeshTools namespace, algorithms for dealing with mesh data. Depends onCorradeStridedArrayView.h , the implementation depends onCorradeArray.h andMagnumMathBatch.hpp . |
[1] — lines of code after a preprocessor run, with system includesexpanded. Gathered using GCC 14.2 and libstdc++, unless said otherwise.
[2] — not a total size due to inter-library dependencies
[3] — gathered using Clang 18.1 and libc++, since libstdc++ doesn'thave a forward declaration forstd::array
/std::vector
[4] — gathered using GCC 14.2, libstdc++ and-std=c++17
Single-header libraries provided here aregenerated from multi-file sourcesin the Magnum project. This is done for two reasons — first, documentation andtest coverage is much easier to maintain in the setting of a bigger project,avoiding any redundancy or duplicated efforts. Second, because the resultingfiles are generated with non-essential parts stripped away, there's no need toworry about bloating them due to original implementations having extensivedocumentation or rarely used features.
With the goal being easy integration, the files are deliberately free of allcomments and documentation blocks to keep their size small. Documentation foreach library is provided in the official Magnum documentation, linked from thetable above. Each library file contains the same documentation link, togetherwith a concrete Git revision it was generated from and a changelog for a fewversions back for easier overview when updating.
For more information read thesingle-header library docs. The libraries are generatedusingacme.py
, which is a part of Corrade.See its documentation, if youare interested. Particular libraries are introduced on the Magnum blog:
- Lightweight but still STL-compatible unique pointer(Jan 16, 2019)
- Array view implementations in Magnum(Feb 18, 2019)
- Forward-declaring STL container types(Mar 28, 2019)
- Multi-dimensional strided array views in Magnum(Apr 30, 2019)
- Convenient CPU feature detection and dispatch(Aug 2, 2022)
Testing done in this repository is mainly to ensure the libraries are generatedcorrectly. Extensive testing on variety of compilers and OSes with > 99% testcoverage is done in the Magnum Project itself. See theBuild Status page for moreinformation.
As always, bug reports, feature requests and code contributions are verywelcome. However again please note the files in this repository are generatedfrom original sources in thecorrade andmagnum repositories, meaning that ideallyall PRs should go there instead, as there's a better infrastructure fordocumentation and testing. We don't enforce this rule though — if you have animportant bugfix, it's better if you submit it here than not at all 😉
All libraries are tested on these platforms:
- Linux and embedded Linux
- Windows,Windows RT (Store/Phone)
- macOS,iOS
- Android
- Web (asm.js orWebAssembly),throughEmscripten
And on these compilers:
- GCC 4.8.1 and newer (and equivalent MinGW-w64 version)
- Clang 6.0 and newer (or AppleClang 10.0 and newer), both
libstdc++
andlibc++
- MSVC 2015 and newer
- Project homepage —https://magnum.graphics/
- Documentation —https://doc.magnum.graphics/
- GitHub —https://github.com/mosra/magnum-singles and the#magnum topic
- GitLab —https://gitlab.com/mosra/magnum-singles
- Gitter community chat —https://gitter.im/mosra/magnum
- E-mail —info@magnum.graphics
- Google Groups mailing list —magnum-engine@googlegroups.com(archive)
- Twitter —https://twitter.com/czmosra and the#MagnumEngine hashtag
See also the Magnum ProjectContact & Support pagefor further information.
Libraries presented here are a result of a dedicated work by many communitymembers. List of all contributors to the Magnum Project can be foundin the documentation.
Magnum is licensed under the MIT/Expat license, see theCOPYING filefor details.
About
Single-header libraries from the Magnum engine