aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2020-02-28 13:45:42 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-17 10:33:32 +0000
commitf92bfb1bdea0798fc7e1236675465b5bd7b90b79 (patch)
tree751062720a0836069f8f2917d1451c50120009f0 /src/tools
parent9e2a78564f0fc07f1ea3d15a31fa7ca3a0f6424d (diff)
vppapigen: generate define for module_semver
Generate a semver define for API modules in the VPP side C generator. E.g in map.api_types.h \#define VL_API_MAP_API_VERSION_MAJOR 4 \#define VL_API_MAP_API_VERSION_MINOR 2 \#define VL_API_MAP_API_VERSION_PATCH 1 Type: improvement Change-Id: I2ab86154e85e26fb075c4e91a01ff3692640654b Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/vppapigen/vppapigen_c.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py
index b7a62dc4102..bf55739094d 100644
--- a/src/tools/vppapigen/vppapigen_c.py
+++ b/src/tools/vppapigen/vppapigen_c.py
@@ -525,6 +525,13 @@ def generate_include_types(s, module, stream):
write('#ifndef included_{module}_api_types_h\n'.format(module=module))
write('#define included_{module}_api_types_h\n'.format(module=module))
+ if 'version' in s['Option']:
+ v = s['Option']['version']
+ (major, minor, patch) = v.split('.')
+ write('#define VL_API_{m}_API_VERSION_MAJOR {v}\n'.format(m=module.upper(), v=major))
+ write('#define VL_API_{m}_API_VERSION_MINOR {v}\n'.format(m=module.upper(), v=minor))
+ write('#define VL_API_{m}_API_VERSION_PATCH {v}\n'.format(m=module.upper(), v=patch))
+
if len(s['Import']):
write('/* Imported API files */\n')
for i in s['Import']: