Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp

This commit is contained in:
Aaron Franke 2025-03-03 22:27:29 -08:00
parent 74907876d3
commit 97ee05e9b7
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
53 changed files with 220 additions and 197 deletions

View file

@ -106,16 +106,16 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
{
//header
Dictionary header;
header["version_major"] = VERSION_MAJOR;
header["version_minor"] = VERSION_MINOR;
#if VERSION_PATCH
header["version_patch"] = VERSION_PATCH;
header["version_major"] = GODOT_VERSION_MAJOR;
header["version_minor"] = GODOT_VERSION_MINOR;
#if GODOT_VERSION_PATCH
header["version_patch"] = GODOT_VERSION_PATCH;
#else
header["version_patch"] = 0;
#endif
header["version_status"] = VERSION_STATUS;
header["version_build"] = VERSION_BUILD;
header["version_full_name"] = VERSION_FULL_NAME;
header["version_status"] = GODOT_VERSION_STATUS;
header["version_build"] = GODOT_VERSION_BUILD;
header["version_full_name"] = GODOT_VERSION_FULL_NAME;
#if REAL_T_IS_DOUBLE
header["precision"] = "double";
@ -1603,8 +1603,8 @@ Error GDExtensionAPIDump::validate_extension_json_file(const String &p_path) {
int major = header["version_major"];
int minor = header["version_minor"];
ERR_FAIL_COND_V_MSG(major != VERSION_MAJOR, ERR_INVALID_DATA, vformat("JSON API dump is for a different engine version (%d) than this one (%d)", major, VERSION_MAJOR));
ERR_FAIL_COND_V_MSG(minor > VERSION_MINOR, ERR_INVALID_DATA, vformat("JSON API dump is for a newer version of the engine: %d.%d", major, minor));
ERR_FAIL_COND_V_MSG(major != GODOT_VERSION_MAJOR, ERR_INVALID_DATA, vformat("JSON API dump is for a different engine version (%d) than this one (%d)", major, GODOT_VERSION_MAJOR));
ERR_FAIL_COND_V_MSG(minor > GODOT_VERSION_MINOR, ERR_INVALID_DATA, vformat("JSON API dump is for a newer version of the engine: %d.%d", major, minor));
}
bool failed = false;

View file

@ -243,23 +243,23 @@ GDExtensionInterfaceFunctionPtr gdextension_get_proc_address(const char *p_name)
#ifndef DISABLE_DEPRECATED
static void gdextension_get_godot_version(GDExtensionGodotVersion *r_godot_version) {
r_godot_version->major = VERSION_MAJOR;
r_godot_version->minor = VERSION_MINOR;
r_godot_version->patch = VERSION_PATCH;
r_godot_version->string = VERSION_FULL_NAME;
r_godot_version->major = GODOT_VERSION_MAJOR;
r_godot_version->minor = GODOT_VERSION_MINOR;
r_godot_version->patch = GODOT_VERSION_PATCH;
r_godot_version->string = GODOT_VERSION_FULL_NAME;
}
#endif
static void gdextension_get_godot_version2(GDExtensionGodotVersion2 *r_godot_version) {
r_godot_version->major = VERSION_MAJOR;
r_godot_version->minor = VERSION_MINOR;
r_godot_version->patch = VERSION_PATCH;
r_godot_version->hex = VERSION_HEX;
r_godot_version->status = VERSION_STATUS;
r_godot_version->build = VERSION_BUILD;
r_godot_version->hash = VERSION_HASH;
r_godot_version->timestamp = VERSION_TIMESTAMP;
r_godot_version->string = VERSION_FULL_NAME;
r_godot_version->major = GODOT_VERSION_MAJOR;
r_godot_version->minor = GODOT_VERSION_MINOR;
r_godot_version->patch = GODOT_VERSION_PATCH;
r_godot_version->hex = GODOT_VERSION_HEX;
r_godot_version->status = GODOT_VERSION_STATUS;
r_godot_version->build = GODOT_VERSION_BUILD;
r_godot_version->hash = GODOT_VERSION_HASH;
r_godot_version->timestamp = GODOT_VERSION_TIMESTAMP;
r_godot_version->string = GODOT_VERSION_FULL_NAME;
}
// Memory Functions

View file

@ -307,12 +307,12 @@ Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
bool compatible = true;
// Check version lexicographically.
if (VERSION_MAJOR != compatibility_minimum[0]) {
compatible = VERSION_MAJOR > compatibility_minimum[0];
} else if (VERSION_MINOR != compatibility_minimum[1]) {
compatible = VERSION_MINOR > compatibility_minimum[1];
if (GODOT_VERSION_MAJOR != compatibility_minimum[0]) {
compatible = GODOT_VERSION_MAJOR > compatibility_minimum[0];
} else if (GODOT_VERSION_MINOR != compatibility_minimum[1]) {
compatible = GODOT_VERSION_MINOR > compatibility_minimum[1];
} else {
compatible = VERSION_PATCH >= compatibility_minimum[2];
compatible = GODOT_VERSION_PATCH >= compatibility_minimum[2];
}
if (!compatible) {
ERR_PRINT(vformat("GDExtension only compatible with Godot version %d.%d.%d or later: %s", compatibility_minimum[0], compatibility_minimum[1], compatibility_minimum[2], p_path));
@ -334,15 +334,15 @@ Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
}
compatible = true;
if (VERSION_MAJOR != compatibility_maximum[0]) {
compatible = VERSION_MAJOR < compatibility_maximum[0];
} else if (VERSION_MINOR != compatibility_maximum[1]) {
compatible = VERSION_MINOR < compatibility_maximum[1];
if (GODOT_VERSION_MAJOR != compatibility_maximum[0]) {
compatible = GODOT_VERSION_MAJOR < compatibility_maximum[0];
} else if (GODOT_VERSION_MINOR != compatibility_maximum[1]) {
compatible = GODOT_VERSION_MINOR < compatibility_maximum[1];
}
#if VERSION_PATCH
#if GODOT_VERSION_PATCH
// #if check to avoid -Wtype-limits warning when 0.
else {
compatible = VERSION_PATCH <= compatibility_maximum[2];
compatible = GODOT_VERSION_PATCH <= compatibility_maximum[2];
}
#endif