VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
version.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 by Thun Lu. All rights reserved.
3 * Author: Thun Lu <thun.lu@zohomail.cn>
4 * Repo: https://github.com/thun-res/vlink
5 * _ __ __ _ __
6 * | | / / / / (_) ____ / /__
7 * | | / / / / / / / __ \ / //_/
8 * | |/ / / /___ / / / / / / / ,<
9 * |___/ /_____/ /_/ /_/ /_/ /_/|_|
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
24/**
25 * @file version.h
26 * @brief VLink library version constants, build-time feature flags, and version comparison macros.
27 *
28 * @details
29 * This header exposes the VLink library version as three numeric constants
30 * (@c VLINK_VERSION_MAJOR, @c VLINK_VERSION_MINOR, @c VLINK_VERSION_PATCH) and as a
31 * dot-separated string (@c VLINK_VERSION). It also defines compile-time feature
32 * flags that control which optional subsystems are compiled into the library.
33 *
34 * When the CMake-generated @c version_config.h is present it takes precedence;
35 * the fallback definitions below are used in header-only or out-of-tree builds.
36 *
37 * @par Version Comparison
38 * Use @c VLINK_VERSION_CHECK together with @c VLINK_VERSION_VALUE to guard
39 * version-dependent code at compile time:
40 * @code
41 * #if VLINK_VERSION_VALUE >= VLINK_VERSION_CHECK(2, 0, 0)
42 * // safe to use VLink 2.0.0 APIs
43 * #endif
44 * @endcode
45 */
46
47#pragma once
48
49#if __has_include("./vlink/version_config.h")
50
51#include "./vlink/version_config.h"
52
53#else
54
55#define VLINK_VERSION_MAJOR 2
56#define VLINK_VERSION_MINOR 0
57#define VLINK_VERSION_PATCH 0
58#define VLINK_VERSION "2.0.0"
59#define VLINK_VERSION_TIMESTAMP ""
60#define VLINK_VERSION_TAG ""
61#define VLINK_VERSION_COMMIT_ID ""
62
63#ifndef VLINK_ENABLE_CXX_STD_20
64#if __cplusplus >= 202002L
65#define VLINK_ENABLE_CXX_STD_20
66#endif
67#endif
68
69#ifndef VLINK_ENABLE_C_API
70#define VLINK_ENABLE_C_API
71#endif
72
73#ifndef VLINK_ENABLE_SECURITY
74#define VLINK_ENABLE_SECURITY
75#endif
76
77#ifndef VLINK_ENABLE_ZSTD
78// #define VLINK_ENABLE_ZSTD
79#endif
80
81#ifndef VLINK_ENABLE_SQLITE
82#define VLINK_ENABLE_SQLITE
83#endif
84
85#ifndef VLINK_ENABLE_CLI_INFO
86#define VLINK_ENABLE_CLI_INFO
87#endif
88
89#ifndef VLINK_ENABLE_CLI_BAG
90#define VLINK_ENABLE_CLI_BAG
91#endif
92
93#ifndef VLINK_ENABLE_CLI_EPROTO
94#define VLINK_ENABLE_CLI_EPROTO
95#endif
96
97#ifndef VLINK_ENABLE_CLI_EFBS
98#define VLINK_ENABLE_CLI_EFBS
99#endif
100
101#ifndef VLINK_ENABLE_CLI_LIST
102#define VLINK_ENABLE_CLI_LIST
103#endif
104
105#ifndef VLINK_ENABLE_CLI_MONITOR
106#define VLINK_ENABLE_CLI_MONITOR
107#endif
108
109#ifndef VLINK_ENABLE_CLI_DUMP
110#define VLINK_ENABLE_CLI_DUMP
111#endif
112
113#ifndef VLINK_ENABLE_CLI_CHECK
114#define VLINK_ENABLE_CLI_CHECK
115#endif
116
117#ifndef VLINK_ENABLE_LOG_QUI
118// #define VLINK_ENABLE_LOG_QUI
119#endif
120
121#ifndef VLINK_ENABLE_LOG_SPD
122// #define VLINK_ENABLE_LOG_SPD
123#endif
124
125#ifndef VLINK_ENABLE_LOG_DLT
126// #define VLINK_ENABLE_LOG_DLT
127#endif
128
129#ifndef VLINK_ENABLE_LOG_NAT
130#define VLINK_ENABLE_LOG_NAT
131#endif
132
133#ifndef VLINK_ENABLE_PROXY
134#define VLINK_ENABLE_PROXY
135#endif
136
137#ifndef VLINK_ENABLE_VIEWER
138// #define VLINK_ENABLE_VIEWER
139#endif
140
141#ifndef VLINK_ENABLE_EXAMPLES
142// #define VLINK_ENABLE_EXAMPLES
143#endif
144
145#ifndef VLINK_ENABLE_TEST
146#define VLINK_ENABLE_TEST
147#endif
148
149#endif
150
151/**
152 * @def VLINK_VERSION_CHECK(major, minor, patch)
153 * @brief Encodes a version triple into a single 24-bit integer for comparison.
154 *
155 * @details
156 * Packs @p major into bits 23-16, @p minor into bits 15-8, and @p patch into
157 * bits 7-0. Use this macro together with @c VLINK_VERSION_VALUE to perform
158 * compile-time version checks.
159 *
160 * @param major Major version component (0-255).
161 * @param minor Minor version component (0-255).
162 * @param patch Patch version component (0-255).
163 * @return Encoded 24-bit integer representation of the version triple.
164 */
165#define VLINK_VERSION_CHECK(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch))
166
167/**
168 * @def VLINK_VERSION_VALUE
169 * @brief The packed 24-bit integer value for the current VLink library version.
170 *
171 * @details
172 * Equivalent to @c VLINK_VERSION_CHECK(VLINK_VERSION_MAJOR, VLINK_VERSION_MINOR, VLINK_VERSION_PATCH).
173 * Compare this against @c VLINK_VERSION_CHECK(x, y, z) to conditionally enable
174 * code paths that depend on a minimum library version.
175 */
176#define VLINK_VERSION_VALUE VLINK_VERSION_CHECK(VLINK_VERSION_MAJOR, VLINK_VERSION_MINOR, VLINK_VERSION_PATCH)
177
178/*
179 * _ooOoo_
180 * o8888888o
181 * 88" . "88
182 * (| -_- |)
183 * O\ = /O
184 * ____/`---'\____
185 * . ' \\| |// `.
186 * / \\||| : |||// \
187 * / _||||| -:- |||||- \
188 * | | \\\ - /// | |
189 * | \_| ''\---/'' | |
190 * \ .-\__ `-` ___/-. /
191 * ___`. .' /--.--\ `. . __
192 * ."" '< `.___\_<|>_/___.' >'"".
193 * | | : `- \`.;`\ _ /`;.`/ - ` : | |
194 * \ \ `-. \_ __\ /__ _/ .-` / /
195 * ======`-.____`-.___\_____/___.-`____.-'======
196 * `=---='
197 */