Skip to content

Commit 0ebbd46

Browse files
Merge pull request #17 from ESP32Async/version
Introduce AsyncWebServerVersion.h to more easily manage library version
2 parents 9bdefb8 + d1331c5 commit 0ebbd46

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

src/AsyncWebServerVersion.h

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-License-Identifier: LGPL-3.0-or-later
2+
// Copyright 2016-2025 Hristo Gochkov, Mathieu Carbou, Emil Muratov
3+
4+
#pragma once
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
/** Major version number (X.x.x) */
11+
#define ASYNCWEBSERVER_VERSION_MAJOR 3
12+
/** Minor version number (x.X.x) */
13+
#define ASYNCWEBSERVER_VERSION_MINOR 6
14+
/** Patch version number (x.x.X) */
15+
#define ASYNCWEBSERVER_VERSION_PATCH 2
16+
17+
/**
18+
* Macro to convert version number into an integer
19+
*
20+
* To be used in comparisons, such as ASYNCWEBSERVER_VERSION >= ASYNCWEBSERVER_VERSION_VAL(2, 0, 0)
21+
*/
22+
#define ASYNCWEBSERVER_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
23+
24+
/**
25+
* Current version, as an integer
26+
*
27+
* To be used in comparisons, such as ASYNCWEBSERVER_VERSION_NUM >= ASYNCWEBSERVER_VERSION_VAL(2, 0, 0)
28+
*/
29+
#define ASYNCWEBSERVER_VERSION_NUM ASYNCWEBSERVER_VERSION_VAL(ASYNCWEBSERVER_VERSION_MAJOR, ASYNCWEBSERVER_VERSION_MINOR, ASYNCWEBSERVER_VERSION_PATCH)
30+
31+
/**
32+
* Current version, as string
33+
*/
34+
#define df2xstr(s) #s
35+
#define df2str(s) df2xstr(s)
36+
#define ASYNCWEBSERVER_VERSION df2str(ASYNCWEBSERVER_VERSION_MAJOR) "." df2str(ASYNCWEBSERVER_VERSION_MINOR) "." df2str(ASYNCWEBSERVER_VERSION_PATCH)
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif

src/ESPAsyncWebServer.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@
4848

4949
#include "literals.h"
5050

51-
#define ASYNCWEBSERVER_VERSION "3.6.2"
52-
#define ASYNCWEBSERVER_VERSION_MAJOR 3
53-
#define ASYNCWEBSERVER_VERSION_MINOR 6
54-
#define ASYNCWEBSERVER_VERSION_REVISION 2
51+
#include "AsyncWebServerVersion.h"
5552
#define ASYNCWEBSERVER_FORK_ESP32Async
5653

5754
#ifdef ASYNCWEBSERVER_REGEX

0 commit comments

Comments
 (0)