[v1,2/4] app/test-pmd-api: Add POC with gRPC deps
Checks
Commit Message
From: Owen Hilyard <ohilyard@iol.unh.edu>
The new app is disabled if the dependencies are not present, in order to
avoid breaking the build on any system that does not have gRPC
installed. The meson file for the app is heavily derived from
the testpmd.
Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
app/meson.build | 17 +++++++
app/test-pmd-api/meson.build | 96 ++++++++++++++++++++++++++++++++++++
2 files changed, 113 insertions(+)
create mode 100644 app/test-pmd-api/meson.build
@@ -20,6 +20,23 @@ apps = [
'test-sad',
]
+if get_option('use_cpp')
+ protoc = find_program('protoc', required : false)
+ protobuf_dep = dependency('protobuf', required : false)
+ grpc_cpp_plugin = find_program('grpc_cpp_plugin', required: false)
+ grpc_python_plugin = find_program('grpc_python_plugin', required: false)
+ grpc_dep = dependency('grpc', required: false)
+ grpcpp_dep = dependency('grpc++', required: false)
+
+ if protoc.found() and dep.found() and grpc_cpp_plugin.found() and grpc_python_plugin.found() and grpc_dep.found() and grpcpp_dep.found()
+ apps += [
+ 'test-pmd-api'
+ ]
+ endif
+
+endif
+
+
default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
default_ldflags = []
if get_option('default_library') == 'static' and not is_windows
new file mode 100644
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2017 Intel Corporation
+
+# override default name to drop the hyphen
+name = 'testpmd-api'
+cflags += [
+ '-Wno-deprecated-declarations'
+]
+sources += files(
+ 'main.c',
+ 'api_impl.cc'
+)
+
+ldflags += [
+ '-ldl',
+ '-lgrpc++_reflection',
+]
+
+ext_deps += [protobuf_dep, grpc_dep, grpcpp_dep, dependency('threads')]
+
+if dpdk_conf.has('RTE_HAS_JANSSON')
+ ext_deps += jansson_dep
+endif
+
+deps += ['ethdev', 'cmdline', 'bus_pci']
+if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
+ deps += 'crypto_scheduler'
+endif
+if dpdk_conf.has('RTE_LIB_BITRATESTATS')
+ deps += 'bitratestats'
+endif
+if dpdk_conf.has('RTE_LIB_BPF')
+ deps += 'bpf'
+endif
+if dpdk_conf.has('RTE_LIB_GRO')
+ deps += 'gro'
+endif
+if dpdk_conf.has('RTE_LIB_GSO')
+ deps += 'gso'
+endif
+if dpdk_conf.has('RTE_LIB_LATENCYSTATS')
+ deps += 'latencystats'
+endif
+if dpdk_conf.has('RTE_LIB_METRICS')
+ deps += 'metrics'
+endif
+if dpdk_conf.has('RTE_LIB_PDUMP')
+ deps += 'pdump'
+endif
+if dpdk_conf.has('RTE_NET_BOND')
+ deps += 'net_bond'
+endif
+if dpdk_conf.has('RTE_NET_BNXT')
+ deps += 'net_bnxt'
+endif
+if dpdk_conf.has('RTE_NET_I40E')
+ deps += 'net_i40e'
+endif
+if dpdk_conf.has('RTE_NET_IXGBE')
+ deps += 'net_ixgbe'
+endif
+if dpdk_conf.has('RTE_NET_DPAA')
+ deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa']
+endif
+
+if meson.version().version_compare('>=0.55')
+ grpc_cpp_plugin_path = grpc_cpp_plugin.full_path()
+ grpc_python_plugin_path = grpc_python_plugin.full_path()
+else
+ grpc_cpp_plugin_path = grpc_cpp_plugin.path()
+ grpc_python_plugin_path = grpc_python_plugin.path()
+endif
+
+
+cpp_generator = generator(protoc,
+ output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h', '@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'],
+ arguments : [
+ '--proto_path=@CURRENT_SOURCE_DIR@',
+ '--plugin=protoc-gen-grpc=@0@'.format(grpc_cpp_plugin_path),
+ '--cpp_out=@BUILD_DIR@',
+ '--grpc_out=@BUILD_DIR@',
+ '@INPUT@'
+ ])
+
+python_generator = generator(protoc,
+ output : ['@BASENAME@_pb2.py', '@BASENAME@_pb2_grpc.py'],
+ arguments : [
+ '--proto_path=@CURRENT_SOURCE_DIR@',
+ '--plugin=protoc-gen-grpc=@0@'.format(grpc_python_plugin_path),
+ '--python_out=@BUILD_DIR@',
+ '--grpc_out=@BUILD_DIR@',
+ '@INPUT@'
+ ])
+
+sources += cpp_generator.process('api.proto')
+sources += python_generator.process('api.proto')
\ No newline at end of file