|
| 1 | +/* |
| 2 | + * Copyright 2020-2025 Ryan Powell <ryan@nable-embedded.io> and |
| 3 | + * esp-nimble-cpp, NimBLE-Arduino contributors. |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +#ifndef NIMBLE_CPP_VERSION_H_ |
| 19 | +#define NIMBLE_CPP_VERSION_H_ |
| 20 | + |
| 21 | +/** @brief NimBLE-Arduino library major version number. */ |
| 22 | +#define NIMBLE_CPP_VERSION_MAJOR 2 |
| 23 | + |
| 24 | +/** @brief NimBLE-Arduino library minor version number. */ |
| 25 | +#define NIMBLE_CPP_VERSION_MINOR 3 |
| 26 | + |
| 27 | +/** @brief NimBLE-Arduino library patch version number. */ |
| 28 | +#define NIMBLE_CPP_VERSION_PATCH 9 |
| 29 | + |
| 30 | +/** |
| 31 | + * @brief Macro to create a version number for comparison. |
| 32 | + * @param major Major version number. |
| 33 | + * @param minor Minor version number. |
| 34 | + * @param patch Patch version number. |
| 35 | + * @details Example usage: |
| 36 | + * @code{.cpp} |
| 37 | + * #if NIMBLE_CPP_VERSION >= NIMBLE_CPP_VERSION_VAL(2, 0, 0) |
| 38 | + * // Using NimBLE-Arduino v2 or later |
| 39 | + * #endif |
| 40 | + * @endcode |
| 41 | + */ |
| 42 | +#define NIMBLE_CPP_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) |
| 43 | + |
| 44 | +/** |
| 45 | + * @brief The library version as a single integer for compile-time comparison. |
| 46 | + * @details Format: (major << 16) | (minor << 8) | patch |
| 47 | + */ |
| 48 | +#define NIMBLE_CPP_VERSION \ |
| 49 | + NIMBLE_CPP_VERSION_VAL(NIMBLE_CPP_VERSION_MAJOR, NIMBLE_CPP_VERSION_MINOR, NIMBLE_CPP_VERSION_PATCH) |
| 50 | + |
| 51 | +/** @cond NIMBLE_CPP_INTERNAL */ |
| 52 | +#define NIMBLE_CPP_VERSION_STRINGIFY_IMPL(x) #x |
| 53 | +#define NIMBLE_CPP_VERSION_STRINGIFY(x) NIMBLE_CPP_VERSION_STRINGIFY_IMPL(x) |
| 54 | +/** @endcond */ |
| 55 | + |
| 56 | +/** |
| 57 | + * @brief Optional Semantic Versioning prerelease suffix. |
| 58 | + * @details Include the leading '-' when defined, for example: "-beta.1" |
| 59 | + */ |
| 60 | +#ifndef NIMBLE_CPP_VERSION_PRERELEASE |
| 61 | +# define NIMBLE_CPP_VERSION_PRERELEASE "" |
| 62 | +#endif |
| 63 | + |
| 64 | +/** |
| 65 | + * @brief Optional Semantic Versioning build metadata suffix. |
| 66 | + * @details Include the leading '+' when defined, for example: "+sha.abcd1234" |
| 67 | + */ |
| 68 | +#ifndef NIMBLE_CPP_VERSION_BUILD_METADATA |
| 69 | +# define NIMBLE_CPP_VERSION_BUILD_METADATA "" |
| 70 | +#endif |
| 71 | + |
| 72 | +/** @brief library version as a prefixed Semantic Versioning string. */ |
| 73 | +#define NIMBLE_CPP_VERSION_STR \ |
| 74 | + "NimBLE-CPP " \ |
| 75 | + NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_MAJOR) "." \ |
| 76 | + NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_MINOR) "." \ |
| 77 | + NIMBLE_CPP_VERSION_STRINGIFY(NIMBLE_CPP_VERSION_PATCH) \ |
| 78 | + NIMBLE_CPP_VERSION_PRERELEASE NIMBLE_CPP_VERSION_BUILD_METADATA |
| 79 | + |
| 80 | +#endif // NIMBLE_CPP_VERSION_H_ |
0 commit comments