diff options
author | Joost Heitbrink <joostheitbrink@outlook.com> | 2019-11-30 17:22:22 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-01-06 13:13:17 +0100 |
commit | dc61323b2ce5478b1fc07581e64f7b7fcfdaf239 (patch) | |
tree | 274e43b88e7e666418730cc522ef1db6c8ead375 /core/version.h | |
parent | 845480497207839bef48997d152f00b60b6176a8 (diff) | |
download | redot-engine-dc61323b2ce5478b1fc07581e64f7b7fcfdaf239.tar.gz |
PCK: Set VERSION_PATCH in header, factor out header magic
Unify pack file version and magic to avoid hardcoded literals.
`version.py` now always includes `patch` even for the first release in
a new stable branch (e.g. 3.2). The public name stays without the patch
number, but `Engine.get_version_info()` already included `patch == 0`,
and we can remove some extra handling of undefined `VERSION_PATCH` this
way.
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'core/version.h')
-rw-r--r-- | core/version.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/core/version.h b/core/version.h index a790152ca4..42c85c1b13 100644 --- a/core/version.h +++ b/core/version.h @@ -28,6 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifndef GODOT_VERSION_H +#define GODOT_VERSION_H + #include "core/version_generated.gen.h" // Godot versions are of the form <major>.<minor> for the initial release, @@ -38,18 +41,18 @@ // forward-compatible. // Example: "3.1" #define VERSION_BRANCH "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) -#ifdef VERSION_PATCH +#if VERSION_PATCH // Example: "3.1.4" #define VERSION_NUMBER "" VERSION_BRANCH "." _MKSTR(VERSION_PATCH) +#else // patch is 0, we don't include it in the "pretty" version number. +// Example: "3.1" instead of "3.1.0" +#define VERSION_NUMBER "" VERSION_BRANCH +#endif // VERSION_PATCH + // Version number encoded as hexadecimal int with one byte for each number, // for easy comparison from code. // Example: 3.1.4 will be 0x030104, making comparison easy from script. #define VERSION_HEX 0x10000 * VERSION_MAJOR + 0x100 * VERSION_MINOR + VERSION_PATCH -#else -// Example: "3.1" -#define VERSION_NUMBER "" VERSION_BRANCH -#define VERSION_HEX 0x10000 * VERSION_MAJOR + 0x100 * VERSION_MINOR -#endif // VERSION_PATCH // Describes the full configuration of that Godot version, including the version number, // the status (beta, stable, etc.) and potential module-specific features (e.g. mono). @@ -64,3 +67,5 @@ // Same as above, but prepended with Godot's name and a cosmetic "v" for "version". // Example: "Godot v3.1.4.stable.official.mono" #define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_FULL_BUILD + +#endif // GODOT_VERSION_H |