-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemrdl_version.h
More file actions
109 lines (92 loc) · 2.91 KB
/
systemrdl_version.h
File metadata and controls
109 lines (92 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#pragma once
/**
* @file systemrdl_version.h
* @brief SystemRDL Toolkit Version Information
*
* This file contains version information for the SystemRDL Toolkit.
* It uses semantic versioning (MAJOR.MINOR.PATCH) format.
*
* Version components:
* - MAJOR: Incremented for incompatible API changes
* - MINOR: Incremented for backward-compatible functionality additions
* - PATCH: Incremented for backward-compatible bug fixes
*/
// Version components
#define SYSTEMRDL_VERSION_MAJOR 0
#define SYSTEMRDL_VERSION_MINOR 2
#define SYSTEMRDL_VERSION_PATCH 2
// Helper macros to create version strings
#define SYSTEMRDL_STRINGIFY(x) #x
#define SYSTEMRDL_TOSTRING(x) SYSTEMRDL_STRINGIFY(x)
// Combined version string
#define SYSTEMRDL_VERSION_STRING \
SYSTEMRDL_TOSTRING(SYSTEMRDL_VERSION_MAJOR) \
"." SYSTEMRDL_TOSTRING(SYSTEMRDL_VERSION_MINOR) "." SYSTEMRDL_TOSTRING(SYSTEMRDL_VERSION_PATCH)
// Numeric version for programmatic comparison
#define SYSTEMRDL_VERSION_NUMBER \
((SYSTEMRDL_VERSION_MAJOR * 10000) + (SYSTEMRDL_VERSION_MINOR * 100) \
+ (SYSTEMRDL_VERSION_PATCH))
// Git information (to be populated by build system)
#ifndef SYSTEMRDL_GIT_COMMIT
#define SYSTEMRDL_GIT_COMMIT "unknown"
#endif
#ifndef SYSTEMRDL_GIT_BRANCH
#define SYSTEMRDL_GIT_BRANCH "unknown"
#endif
#ifndef SYSTEMRDL_BUILD_DATE
#define SYSTEMRDL_BUILD_DATE __DATE__ " " __TIME__
#endif
// Full version string with build info
#define SYSTEMRDL_FULL_VERSION_STRING \
"SystemRDL Toolkit " SYSTEMRDL_VERSION_STRING " (built " SYSTEMRDL_BUILD_DATE ")"
// Version with git info
#define SYSTEMRDL_DETAILED_VERSION_STRING \
"SystemRDL Toolkit " SYSTEMRDL_VERSION_STRING " [" SYSTEMRDL_GIT_BRANCH \
"@" SYSTEMRDL_GIT_COMMIT "]" \
" (built " SYSTEMRDL_BUILD_DATE ")"
namespace systemrdl {
/**
* @brief Get version string
* @return Version string in format "X.Y.Z"
*/
inline const char *get_version()
{
return SYSTEMRDL_VERSION_STRING;
}
/**
* @brief Get full version string with build information
* @return Full version string with build date
*/
inline const char *get_full_version()
{
return SYSTEMRDL_FULL_VERSION_STRING;
}
/**
* @brief Get detailed version string with git information
* @return Detailed version string with git branch and commit
*/
inline const char *get_detailed_version()
{
return SYSTEMRDL_DETAILED_VERSION_STRING;
}
/**
* @brief Get version components
* @param major Output parameter for major version
* @param minor Output parameter for minor version
* @param patch Output parameter for patch version
*/
inline void get_version_components(int &major, int &minor, int &patch)
{
major = SYSTEMRDL_VERSION_MAJOR;
minor = SYSTEMRDL_VERSION_MINOR;
patch = SYSTEMRDL_VERSION_PATCH;
}
/**
* @brief Get numeric version for comparison
* @return Numeric version (MAJOR*10000 + MINOR*100 + PATCH)
*/
inline int get_version_number()
{
return SYSTEMRDL_VERSION_NUMBER;
}
} // namespace systemrdl