Atlas Game Manager
A game manager for f95 and dlsite written in c++
Loading...
Searching...
No Matches
version.hpp
Go to the documentation of this file.
1//
2// Created by kj16609 on 5/9/23.
3//
4
5#pragma once
6#ifndef ATLASGAMEMANAGER_VERSION_HPP
7#define ATLASGAMEMANAGER_VERSION_HPP
8
9#include <iomanip>
10#include <iostream>
11#include <locale>
12#include <sstream>
13
14#ifndef BYPASS_ATLAS_VERSION_STRINGS_REQUIRED
15
16#ifndef ATLAS_GIT_REVISION
17#error "No git commit specified. Specify the revision -DATLAS_GIT_REVISION"
18#endif
19
20#ifndef ATLAS_GIT_REVISION_BRIEF
21#error "No git commit brief specified. Specify the revision -DATLAS_GIT_REVISION_BRIEF"
22#endif
23
24#ifndef ATLAS_GIT_BRANCH
25#error "No git branch specified. Specify the branch via -DATLAS_GIT_BRANCH"
26#endif
27
28#ifndef ATLAS_GIT_TAG
29#error "No git tag specified. Specify the tag with -DATLAS_GIT_TAG"
30#endif
31
32#ifndef ATLAS_GIT_CREATED_TIME
33#error "Unable to get time. Specify the tag with -DATLAS_GIT_TIME"
34#endif
35
36#else
37
38#define ATLAS_VERSION "Debug Build. DO NOT REDISTRIBUTE"
39#define ATLAS_GIT_BRANCH "NOT SET DURING BUILD PROCESS"
40#define ATLAS_GIT_REVISION "NOT SET DURING BUILD PROCESS"
41#define ATLAS_GIT_TAG "NOT SET DURING BUILD PROCESS"
42#define ATLAS_GIT_CREATED_TIME "NOT SET DURING BUILD PROCESS"
43
44#endif
45
46#ifndef NDEBUG
47
48//Tag-Brief | Branch
49#define ATLAS_VERSION_STRING ATLAS_GIT_TAG "-" ATLAS_GIT_REVISION_BRIEF " | " ATLAS_GIT_BRANCH
50
51#else
52
53#define ATLAS_VERSION_STRING ATLAS_GIT_TAG
54
55#endif
56
57//#define ATLAS_VERSION_STR TOSTRING( ATLASVERSION )
58
59namespace utils
60{
61 [[maybe_unused]] constexpr std::string_view version_string { ATLAS_VERSION_STRING };
62 [[maybe_unused]] constexpr std::string_view git_branch { ATLAS_GIT_BRANCH };
63 [[maybe_unused]] constexpr std::string_view git_revision { ATLAS_GIT_REVISION };
64 [[maybe_unused]] constexpr std::string_view git_rev_brief { ATLAS_GIT_REVISION_BRIEF };
65 [[maybe_unused]] constexpr std::string_view git_tag { ATLAS_GIT_TAG };
66 [[maybe_unused]] constexpr std::string_view git_time { ATLAS_GIT_CREATED_TIME };
67
68 inline const QString version_string_qt()
69 {
70 const QString version {
71 QString::fromLocal8Bit( git_tag.data(), static_cast< qsizetype >( git_tag.size() ) )
72 };
73
74 QString branch {
75 QString::fromLocal8Bit( git_branch.data(), static_cast< qsizetype >( git_branch.size() ) )
76 };
77
78 branch = branch == "staging" ? "nightly" : branch;
79
80 const QString sha_short {
81 QString::fromLocal8Bit( git_rev_brief.data(), static_cast< qsizetype >( git_rev_brief.size() ) )
82 };
83
84 return version + "-" + sha_short + " | " + branch;
85 }
86} // namespace utils
87
88#endif //ATLASGAMEMANAGER_VERSION_HPP
Definition mainThread.cpp:8
constexpr std::string_view git_revision
Definition version.hpp:63
constexpr std::string_view version_string
Definition version.hpp:61
constexpr std::string_view git_branch
Definition version.hpp:62
constexpr std::string_view git_rev_brief
Definition version.hpp:64
constexpr std::string_view git_time
Definition version.hpp:66
const QString version_string_qt()
Definition version.hpp:68
constexpr std::string_view git_tag
Definition version.hpp:65
#define ATLAS_VERSION_STRING
Definition version.hpp:49