| 
									
										
										
										
											2017-04-10 23:08:19 +02:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  version.h                                                             */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         This file is part of:                          */ | 
					
						
							|  |  |  | /*                             GODOT ENGINE                               */ | 
					
						
							|  |  |  | /*                        https://godotengine.org                         */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | 
					
						
							|  |  |  | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining  */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the        */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including    */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,    */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to     */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to  */ | 
					
						
							|  |  |  | /* the following conditions:                                              */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be         */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.        */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							| 
									
										
										
										
											2018-01-05 00:50:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-25 11:10:34 +01:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2019-11-30 17:22:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-20 08:40:46 -06:00
										 |  |  | #include "core/version_generated.gen.h" // IWYU pragma: export
 | 
					
						
							| 
									
										
										
										
											2017-04-10 23:08:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-28 16:05:13 -05:00
										 |  |  | #include <stdint.h> // NOLINT(modernize-deprecated-headers) FIXME: MinGW compilation fails when changing to C++ Header.
 | 
					
						
							| 
									
										
										
										
											2022-03-12 02:04:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-24 21:08:15 +01:00
										 |  |  | // Copied from typedefs.h to stay lean.
 | 
					
						
							|  |  |  | #ifndef _STR
 | 
					
						
							|  |  |  | #define _STR(m_x) #m_x
 | 
					
						
							|  |  |  | #define _MKSTR(m_x) _STR(m_x)
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).
The new logic defines:
- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability
Bugs fixed thanks to that:
- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
											
										 
											2018-02-23 19:48:49 +01:00
										 |  |  | // Godot versions are of the form <major>.<minor> for the initial release,
 | 
					
						
							|  |  |  | // and then <major>.<minor>.<patch> for subsequent bugfix releases where <patch> != 0
 | 
					
						
							|  |  |  | // That's arbitrary, but we find it pretty and it's the current policy.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Defines the main "branch" version. Patch versions in this branch should be
 | 
					
						
							|  |  |  | // forward-compatible.
 | 
					
						
							|  |  |  | // Example: "3.1"
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_BRANCH _MKSTR(GODOT_VERSION_MAJOR) "." _MKSTR(GODOT_VERSION_MINOR)
 | 
					
						
							|  |  |  | #if GODOT_VERSION_PATCH
 | 
					
						
							| 
									
										
											  
											
												Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).
The new logic defines:
- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability
Bugs fixed thanks to that:
- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
											
										 
											2018-02-23 19:48:49 +01:00
										 |  |  | // Example: "3.1.4"
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_NUMBER GODOT_VERSION_BRANCH "." _MKSTR(GODOT_VERSION_PATCH)
 | 
					
						
							| 
									
										
										
										
											2024-02-19 10:56:05 +01:00
										 |  |  | #else // patch is 0, we don't include it in the "pretty" version number.
 | 
					
						
							|  |  |  | // Example: "3.1" instead of "3.1.0"
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_NUMBER GODOT_VERSION_BRANCH
 | 
					
						
							|  |  |  | #endif // GODOT_VERSION_PATCH
 | 
					
						
							| 
									
										
										
										
											2019-11-30 17:22:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-17 13:38:52 +01:00
										 |  |  | // 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.
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_HEX 0x10000 * GODOT_VERSION_MAJOR + 0x100 * GODOT_VERSION_MINOR + GODOT_VERSION_PATCH
 | 
					
						
							| 
									
										
											  
											
												Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).
The new logic defines:
- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability
Bugs fixed thanks to that:
- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
											
										 
											2018-02-23 19:48:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Describes the full configuration of that Godot version, including the version number,
 | 
					
						
							| 
									
										
										
										
											2024-11-23 18:40:16 +01:00
										 |  |  | // the status (beta, stable, etc.), potential module-specific features (e.g. mono)
 | 
					
						
							|  |  |  | // and double-precision status.
 | 
					
						
							|  |  |  | // Example: "3.1.4.stable.mono.double"
 | 
					
						
							|  |  |  | #ifdef REAL_T_IS_DOUBLE
 | 
					
						
							|  |  |  | #define GODOT_VERSION_FULL_CONFIG GODOT_VERSION_NUMBER "." GODOT_VERSION_STATUS GODOT_VERSION_MODULE_CONFIG ".double"
 | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_FULL_CONFIG GODOT_VERSION_NUMBER "." GODOT_VERSION_STATUS GODOT_VERSION_MODULE_CONFIG
 | 
					
						
							| 
									
										
										
										
											2024-11-23 18:40:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).
The new logic defines:
- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability
Bugs fixed thanks to that:
- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
											
										 
											2018-02-23 19:48:49 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | // Similar to GODOT_VERSION_FULL_CONFIG, but also includes the (potentially custom) GODOT_VERSION_BUILD
 | 
					
						
							| 
									
										
											  
											
												Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).
The new logic defines:
- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability
Bugs fixed thanks to that:
- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
											
										 
											2018-02-23 19:48:49 +01:00
										 |  |  | // description (e.g. official, custom_build, etc.).
 | 
					
						
							| 
									
										
										
										
											2024-11-23 18:40:16 +01:00
										 |  |  | // Example: "3.1.4.stable.mono.double.official"
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_FULL_BUILD GODOT_VERSION_FULL_CONFIG "." GODOT_VERSION_BUILD
 | 
					
						
							| 
									
										
											  
											
												Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).
The new logic defines:
- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability
Bugs fixed thanks to that:
- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
											
										 
											2018-02-23 19:48:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Same as above, but prepended with Godot's name and a cosmetic "v" for "version".
 | 
					
						
							| 
									
										
										
										
											2024-11-23 18:40:16 +01:00
										 |  |  | // Example: "Godot v3.1.4.stable.official.mono.double"
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | #define GODOT_VERSION_FULL_NAME GODOT_VERSION_NAME " v" GODOT_VERSION_FULL_BUILD
 | 
					
						
							| 
									
										
										
										
											2019-11-30 17:22:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-08 20:50:37 +01:00
										 |  |  | // Git commit hash, generated at build time in `core/version_hash.gen.cpp`.
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | extern const char *const GODOT_VERSION_HASH; | 
					
						
							| 
									
										
										
										
											2022-02-08 20:50:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 02:04:14 +01:00
										 |  |  | // Git commit date UNIX timestamp (in seconds), generated at build time in `core/version_hash.gen.cpp`.
 | 
					
						
							|  |  |  | // Set to 0 if unknown.
 | 
					
						
							| 
									
										
										
										
											2025-03-03 22:27:29 -08:00
										 |  |  | extern const uint64_t GODOT_VERSION_TIMESTAMP; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef DISABLE_DEPRECATED
 | 
					
						
							|  |  |  | // Compatibility with pre-4.5 modules.
 | 
					
						
							|  |  |  | #define VERSION_SHORT_NAME GODOT_VERSION_SHORT_NAME
 | 
					
						
							|  |  |  | #define VERSION_NAME GODOT_VERSION_NAME
 | 
					
						
							|  |  |  | #define VERSION_MAJOR GODOT_VERSION_MAJOR
 | 
					
						
							|  |  |  | #define VERSION_MINOR GODOT_VERSION_MINOR
 | 
					
						
							|  |  |  | #define VERSION_PATCH GODOT_VERSION_PATCH
 | 
					
						
							|  |  |  | #define VERSION_STATUS GODOT_VERSION_STATUS
 | 
					
						
							|  |  |  | #define VERSION_BUILD GODOT_VERSION_BUILD
 | 
					
						
							|  |  |  | #define VERSION_MODULE_CONFIG GODOT_VERSION_MODULE_CONFIG
 | 
					
						
							|  |  |  | #define VERSION_WEBSITE GODOT_VERSION_WEBSITE
 | 
					
						
							|  |  |  | #define VERSION_DOCS_BRANCH GODOT_VERSION_DOCS_BRANCH
 | 
					
						
							|  |  |  | #define VERSION_DOCS_URL GODOT_VERSION_DOCS_URL
 | 
					
						
							|  |  |  | #define VERSION_BRANCH GODOT_VERSION_BRANCH
 | 
					
						
							|  |  |  | #define VERSION_NUMBER GODOT_VERSION_NUMBER
 | 
					
						
							|  |  |  | #define VERSION_HEX GODOT_VERSION_HEX
 | 
					
						
							|  |  |  | #define VERSION_FULL_CONFIG GODOT_VERSION_FULL_CONFIG
 | 
					
						
							|  |  |  | #define VERSION_FULL_BUILD GODOT_VERSION_FULL_BUILD
 | 
					
						
							|  |  |  | #define VERSION_FULL_NAME GODOT_VERSION_FULL_NAME
 | 
					
						
							|  |  |  | #define VERSION_HASH GODOT_VERSION_HASH
 | 
					
						
							|  |  |  | #define VERSION_TIMESTAMP GODOT_VERSION_TIMESTAMP
 | 
					
						
							|  |  |  | #endif // DISABLE_DEPRECATED
 |