summaryrefslogtreecommitdiffstats
path: root/src/vpp-api
diff options
context:
space:
mode:
authorOliver Giles <oliver_g@radwin.com>2019-12-05 23:37:36 +0200
committerDamjan Marion <dmarion@me.com>2019-12-17 18:05:15 +0000
commitdc20371f83ed81462c0b24eb750b76f7819df64a (patch)
tree01eb5b83c0be944987f9cbd4777877c03f6bc36f /src/vpp-api
parent3d14f036199d9b3098268821424b4e6f5e8f46dc (diff)
build: export vapi generation in vpp-dev
Adds the higher-level vapi generation to cmake/api.cmake and exposes the necessary python scripts in vpp-dev, so that out-of-tree/downstream plugins can also leverage the more convenient API. Type: feature Signed-off-by: Oliver Giles <oliver_g@radwin.com> Change-Id: I8c40a14d27ba3cb972c6907632e03c0e7b0ce982
Diffstat (limited to 'src/vpp-api')
-rw-r--r--src/vpp-api/vapi/CMakeLists.txt59
1 files changed, 11 insertions, 48 deletions
diff --git a/src/vpp-api/vapi/CMakeLists.txt b/src/vpp-api/vapi/CMakeLists.txt
index 06c9f85dbba..4c74ae80928 100644
--- a/src/vpp-api/vapi/CMakeLists.txt
+++ b/src/vpp-api/vapi/CMakeLists.txt
@@ -16,60 +16,13 @@ include_directories (
${CMAKE_CURRENT_BINARY_DIR}/..
)
-unset(VAPICLIENT_API_C_HEADERS)
-unset(VAPICLIENT_API_CPP_HEADERS)
-
-get_property(VPP_API_FILES GLOBAL PROPERTY VPP_API_FILES)
-foreach(f ${VPP_API_FILES})
- get_filename_component(output ${f}.vapi.h NAME)
- set(input ${CMAKE_BINARY_DIR}/${f}.json)
-
- # C VAPI Headers
- add_custom_command(
- OUTPUT ${output}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vapi_c_gen.py
- ARGS --remove-path ${input}
- DEPENDS ${input} vapi_c_gen.py vapi_json_parser.py api_headers
- COMMENT "Generating VAPI C header ${output}"
- )
- install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/${output}
- DESTINATION include/vapi
- COMPONENT vpp-dev
- )
- list(APPEND VAPICLIENT_API_CPP_HEADERS ${output})
-
- # C++ VAPI Headers
- get_filename_component(output ${f}.vapi.hpp NAME)
- add_custom_command(
- OUTPUT ${output}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vapi_cpp_gen.py
- ARGS --gen-h-prefix=vapi --remove-path ${input}
- DEPENDS ${input} vapi_cpp_gen.py vapi_json_parser.py api_headers
- COMMENT "Generating VAPI C++ header ${output}"
- )
- install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/${output}
- DESTINATION include/vapi
- COMPONENT vpp-dev
- )
- list(APPEND VAPICLIENT_API_CPP_HEADERS ${output})
-endforeach ()
-
-add_custom_target(all-vapi-headers DEPENDS
- ${VAPICLIENT_API_C_HEADERS}
- ${VAPICLIENT_API_CPP_HEADERS}
-)
-
add_vpp_library(vapiclient
SOURCES
vapi.c
libvapiclient.map
LINK_LIBRARIES vppinfra vlibmemoryclient svm pthread m rt
- DEPENDS all-vapi-headers
+ DEPENDS api_headers
)
install(
@@ -95,3 +48,13 @@ install(
COMPONENT
vpp-dev
)
+
+install(
+ PROGRAMS
+ vapi_c_gen.py
+ vapi_cpp_gen.py
+ vapi_json_parser.py
+
+ DESTINATION bin
+ COMPONENT vpp-dev
+)