diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-03 09:28:01 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-03 09:28:01 -0500 |
commit | b50980ad70684530d55b7adf20de6047ebf53ba2 (patch) | |
tree | 576d284c732e2b5bfc7638a23d9bca4c86f5437c /source/libfud.cpp | |
parent | e420eca2b244c303af51534ab09632045a186b21 (diff) |
Use a configure file for versioning including git revision.
Diffstat (limited to 'source/libfud.cpp')
-rw-r--r-- | source/libfud.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/libfud.cpp b/source/libfud.cpp index e1dad1d..252eae0 100644 --- a/source/libfud.cpp +++ b/source/libfud.cpp @@ -17,10 +17,26 @@ #include "libfud.hpp" +#include "fud_assert.hpp" +#include "git_version.hpp" + #include <cstdlib> namespace fud { +FUD fud() +{ + FUD fudInfo{}; + fudInfo.major = FudVersionMajor; + fudInfo.minor = FudVersionMinor; + fudInfo.patch = FudVersionPatch; + static_assert(sizeof(GitHash) >= sizeof(fudInfo.revision)); + auto copyResult = copyMem(fudInfo.revision.data(), fudInfo.revision.size(), GitHash, fudInfo.revision.size() - 1); + fudAssert(copyResult == FudStatus::Success); + fudInfo.revision[fudInfo.revision.size() - 1] = '\0'; + return fudInfo; +} + Result<String, FudStatus> getEnv(const char* name) { using RetType = Result<String, FudStatus>; |