ESPectre SDK 2.8.0-280-gac7af68
Wi-Fi CSI motion sensing for ESP32 firmware
Loading...
Searching...
No Matches
espectre_sdk_version.h
Go to the documentation of this file.
1/*
2 * ESPectre - SDK Version
3 *
4 * Compile-time version of the embedded ESPectre SDK.
5 *
6 * Author: Francesco Pace <francesco.pace@gmail.com>
7 * SPDX-License-Identifier: GPL-3.0-only
8 * Commercial licensing available under separate agreement; see LICENSING.md.
9 */
10#pragma once
11
12/**
13 * @file espectre_sdk_version.h
14 * @brief Compile-time identity of the ESPectre SDK sources you compiled against.
15 *
16 * This is the version of the *SDK*, not of your firmware. The two are
17 * deliberately separate:
18 *
19 * - `ESPECTRE_SDK_VERSION_STRING` is baked in at compile time and identifies
20 * the ESPectre sources in your build. Use it in diagnostics, bug reports,
21 * and to guard code against SDK releases.
22 * - `espectre::espectre_firmware_version()` (`firmware_version.h`) reports the
23 * *application* version supplied by your build system. In an integration it
24 * is your product's version, not ESPectre's.
25 *
26 * First-party firmware and host tests define these macros from `git describe`,
27 * using either the numeric tag or a moving `<tag>-<commit-count>-g<hash>`
28 * identity. Published SDK bundles stamp the same identity into this header.
29 * There is no in-tree fallback:
30 * configure fails without git history, and an unstamped header does not
31 * compile. `ESPECTRE_SDK_VERSION_AT_LEAST()` uses the numeric tag core.
32 */
33
34/* ESPECTRE_SDK_VERSION_VALUES_BEGIN */
35#if !defined(ESPECTRE_SDK_VERSION_MAJOR) || !defined(ESPECTRE_SDK_VERSION_MINOR) || \
36 !defined(ESPECTRE_SDK_VERSION_PATCH) || !defined(ESPECTRE_SDK_VERSION_STRING)
37#error "ESPectre SDK version is unresolved. Fetch numeric git tags, pass -DESPECTRE_GIT_VERSION, or use a stamped SDK bundle."
38#endif
39/* ESPECTRE_SDK_VERSION_VALUES_END */
40
41/**
42 * Single comparable integer for the SDK version, as `MMmmpp`.
43 *
44 * Example: `3.0.0` becomes `30000`.
45 */
46#define ESPECTRE_SDK_VERSION_NUMBER \
47 ((ESPECTRE_SDK_VERSION_MAJOR * 10000) + (ESPECTRE_SDK_VERSION_MINOR * 100) + ESPECTRE_SDK_VERSION_PATCH)
48
49/**
50 * Compile-time feature guard.
51 *
52 * Use it to keep one integration compiling against several SDK releases:
53 * @code
54 * #if ESPECTRE_SDK_VERSION_AT_LEAST(3, 1, 0)
55 * controller.set_motion_hits_runtime(3, 5);
56 * #endif
57 * @endcode
58 */
59#define ESPECTRE_SDK_VERSION_AT_LEAST(major, minor, patch) \
60 (ESPECTRE_SDK_VERSION_NUMBER >= ((major) * 10000 + (minor) * 100 + (patch)))
61
62namespace espectre {
63
64/**
65 * The SDK version as a string, usable where a macro is not.
66 *
67 * @return `ESPECTRE_SDK_VERSION_STRING`, valid for the process lifetime.
68 */
69constexpr const char *espectre_sdk_version() { return ESPECTRE_SDK_VERSION_STRING; }
70
71} // namespace espectre
constexpr const char * espectre_sdk_version()
The SDK version as a string, usable where a macro is not.