AsmGrader 0.0.0
Loading...
Searching...
No Matches
version.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <fmt/compile.h>
6#include <fmt/format.h>
7#include <range/v3/iterator.hpp>
8
9#include <array>
10#include <string_view>
11
12// expressions are substituted by CMake
13// clang-format off
14#define ASMGRADER_VERSION_MAJOR 0
15#define ASMGRADER_VERSION_MINOR 0
16#define ASMGRADER_VERSION_PATCH 0
17#define ASMGRADER_VERSION_GIT_HASH 90204232792937f826b87b00a2245163acf61d7e
18// clang-format on
19
20#define ASMGRADER_VERSION_STRING \
21 STRINGIFY(ASMGRADER_VERSION_MAJOR) "." STRINGIFY(ASMGRADER_VERSION_MINOR) "." STRINGIFY(ASMGRADER_VERSION_PATCH)
22#define ASMGRADER_VERSION_GIT_HASH_STRING STRINGIFY(ASMGRADER_VERSION_GIT_HASH)
23
24namespace asmgrader {
25
26consteval unsigned int get_version() {
27 // The maximum value of any MAJOR / MINOR / PATCH field
28 constexpr auto MAX_VERSION_FIELD = 99;
29
30 static_assert(ASMGRADER_VERSION_MAJOR < MAX_VERSION_FIELD);
31 static_assert(ASMGRADER_VERSION_MINOR < MAX_VERSION_FIELD);
32 static_assert(ASMGRADER_VERSION_PATCH < MAX_VERSION_FIELD);
33
34 constexpr auto MINOR_MULTIPLIER = MAX_VERSION_FIELD + 1;
35 constexpr auto MAJOR_MULTIPLIER = MINOR_MULTIPLIER * MINOR_MULTIPLIER;
36
37 return ASMGRADER_VERSION_MAJOR * MAJOR_MULTIPLIER + ASMGRADER_VERSION_MINOR * MINOR_MULTIPLIER +
39}
40
41enum class AppMode { Student, Professor };
42
43#ifdef PROFESSOR_VERSION
44constexpr auto APP_MODE = AppMode::Professor;
45#else
46constexpr auto APP_MODE = AppMode::Student;
47#endif
48
49} // namespace asmgrader
Definition asm_buffer.hpp:20
constexpr auto APP_MODE
Definition version.hpp:46
consteval unsigned int get_version()
Definition version.hpp:26
AppMode
Definition version.hpp:41
#define ASMGRADER_VERSION_MINOR
Definition version.hpp:15
#define ASMGRADER_VERSION_PATCH
Definition version.hpp:16
#define ASMGRADER_VERSION_MAJOR
Definition version.hpp:14