Add ifversion

This command adds `ifversion`, as both a simplified and internal
command.

The system works like so:

- `ifversion(2.6,script2)` -> If you're on 2.6.0 or greater
- `ifversion(2.6.0,script2)` -> Same as above
- `ifversion(2.6.3,script2)` -> You're using 2.6.3 or greater
- `ifversion(2.5,script2)` -> You're using 2.5 or greater
- `ifversion(2,script2)` -> You're using 2.0.0 or greater (yep...)

`ReleaseVersion.h` has a few new defines to make this possible, being
`MAJOR_VERSION`, `MINOR_VERSION` and `PATCH_VERSION`. With the help of
a few macros, `RELEASE_VERSION` is now constructed using those.
This commit is contained in:
NyakoFox
2025-09-13 20:24:39 -03:00
committed by Ethan Lee
parent b8ca587df1
commit 9256100cb9
2 changed files with 77 additions and 1 deletions

View File

@@ -1,6 +1,17 @@
#ifndef RELEASEVERSION_H
#define RELEASEVERSION_H
#define RELEASE_VERSION "v2.5"
#define MAJOR_VERSION 2
#define MINOR_VERSION 5
#define PATCH_VERSION 0
#define VVV_STRINGIFY(x) #x
#define VVV_TOSTRING(x) VVV_STRINGIFY(x)
#if PATCH_VERSION == 0
#define RELEASE_VERSION "v" VVV_TOSTRING(MAJOR_VERSION) "." VVV_TOSTRING(MINOR_VERSION)
#else
#define RELEASE_VERSION "v" VVV_TOSTRING(MAJOR_VERSION) "." VVV_TOSTRING(MINOR_VERSION) "." VVV_TOSTRING(PATCH_VERSION)
#endif
#endif /* RELEASEVERSION_H */