CNDP 22.08.0
Loading...
Searching...
No Matches
cne_version.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2019-2022 Intel Corporation
3 */
4
10
11#ifndef _CNE_VERSION_H_
12#define _CNE_VERSION_H_
13
14#include <stdint.h>
15#include <string.h>
16#include <stdio.h>
17#include <cne_common.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
26#define CNE_VERSION_NUM(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
27
31// clang-format off
32#define CNE_VERSION CNE_VERSION_NUM( \
33 CNE_VER_YEAR, \
34 CNE_VER_MONTH, \
35 CNE_VER_MINOR, \
36 CNE_VER_RELEASE)
37// clang-format on
38
45static inline const char *
47{
48 static char version[32];
49 if (version[0] != 0)
50 return version;
51 // clang-format off
52 if (strlen(CNE_VER_SUFFIX) == 0)
53 snprintf(version, sizeof(version), "%s %d.%02d.%d",
54 CNE_VER_PREFIX,
55 CNE_VER_YEAR,
56 CNE_VER_MONTH,
57 CNE_VER_MINOR);
58 else
59 snprintf(version, sizeof(version), "%s %d.%02d.%d%s%d",
60 CNE_VER_PREFIX,
61 CNE_VER_YEAR,
62 CNE_VER_MONTH,
63 CNE_VER_MINOR,
64 CNE_VER_SUFFIX,
65 CNE_VER_RELEASE);
66 // clang-format on
67 return version;
68}
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif /* CNE_VERSION_H */
static const char * cne_version(void)
Definition cne_version.h:46