|
| 1 | +/** |
| 2 | + * Contains information about the project's version. |
| 3 | + * @file Config.hpp |
| 4 | + * @author qucals |
| 5 | + * @version 0.0.8 24/08/21 |
| 6 | + */ |
| 7 | + |
| 8 | +#ifndef VKAPI_CONFIG_HPP_IN |
| 9 | +#define VKAPI_CONFIG_HPP_IN |
| 10 | + |
| 11 | +namespace vk |
| 12 | +{ |
| 13 | + |
| 14 | +/** |
| 15 | + * @brief Information the version of VKAPI in use. |
| 16 | + * |
| 17 | + * Represents the library's version as three levels: major revision |
| 18 | + * (increments with massive changes, additions, and enhancements), |
| 19 | + * minor revision (increments with backwards-compatible changes to the |
| 20 | + * major revision), and patchlevel (increments with fixes to the minor |
| 21 | + * revision). |
| 22 | + */ |
| 23 | +typedef struct __vkapi_version |
| 24 | +{ |
| 25 | + short major; |
| 26 | + short minor; |
| 27 | + short patch; |
| 28 | +} __vkapi_version; |
| 29 | + |
| 30 | +#define __VKAPI_MAJOR_VERSION 0 |
| 31 | +#define __VKAPI_MINOR_VERSION 0 |
| 32 | +#define __VKAPI_PATCH_VERSION 8 |
| 33 | + |
| 34 | +#ifndef __VKAPI_MAJOR_VERSION |
| 35 | +#define __VKAPI_MAJOR_VERSION 0 |
| 36 | +#endif // __VKAPI_MAJOR_VERSION |
| 37 | + |
| 38 | +#ifndef __VKAPI_MINOR_VERSION |
| 39 | +#define __VKAPI_MINOR_VERSION 0 |
| 40 | +#endif // __VKAPI_MINOR_VERSION |
| 41 | + |
| 42 | +#ifndef __VKAPI_PATCH_VERSION |
| 43 | +#define __VKAPI_PATCH_VERSION 0 |
| 44 | +#endif // __VKAPI_PATCH_VERSION |
| 45 | + |
| 46 | +/** |
| 47 | + * @brief Macro to determine VKAPI version program was compiled against. |
| 48 | + * |
| 49 | + * This macro fills in a __vkapi_version structure with the version of the |
| 50 | + * library you compiled against. This is determined by what header the |
| 51 | + * compiler uses. Note that if you dynamically linked the library, you might |
| 52 | + * have a slightly newer or older version at runtime. That version can be |
| 53 | + * determined with GUCpp_GetVersion(), which, unlike GUCpp_VERSION(), |
| 54 | + * is not a macro. |
| 55 | + * |
| 56 | + * @param x A pointer to a __vkapi_version struct to initialize. |
| 57 | + */ |
| 58 | +#define __VKAPI_VERSION(x) \ |
| 59 | +{ \ |
| 60 | + (x)->major = __VKAPI_MAJOR_VERSION; \ |
| 61 | + (x)->minor = __VKAPI_MINOR_VERSION; \ |
| 62 | + (x)->patch = __VKAPI_PATCH_VERSION; \ |
| 63 | +} |
| 64 | + |
| 65 | +/** |
| 66 | + * This macro turns the version numbers into a numeric value: |
| 67 | + * @verbatim |
| 68 | + (1,2,3) -> (1203) |
| 69 | + @endverbatim |
| 70 | + * |
| 71 | + * This assumes that there will never be more than 100 patchlevels. |
| 72 | + */ |
| 73 | +#define __VKAPI_VERSION_NUM(X, Y, Z) \ |
| 74 | + ((X) * 1000 + (Y) * 100 + (Z)) |
| 75 | + |
| 76 | +/** |
| 77 | + * This is the version number macro for the current GUCpp version. |
| 78 | + */ |
| 79 | +#define __VKAPI_COMPILED_VERSION \ |
| 80 | + __VKAPI_VERSION_NUM(__VKAPI_MAJOR_VERSION, __VKAPI_MINOR_VERSION, __VKAPI_PATCH_VERSION) |
| 81 | + |
| 82 | +/** |
| 83 | + * This macro will evaluate to true if compiled with VKAPI at least X.Y.Z. |
| 84 | + */ |
| 85 | +#define __VKAPI_VERSION_ATLEAST(X, Y, Z) \ |
| 86 | + (__VKAPI_COMPILED_VERSION >= __VKAPI_VERSION_NUM(X, Y, Z)) |
| 87 | + |
| 88 | +} // namespace vk |
| 89 | + |
| 90 | +#endif // VKAPI_CONFIG_HPP_IN |
0 commit comments