[PATCH v1 2/4] app/test-pmd-api: Add POC with gRPC deps
ohilyard at iol.unh.edu
ohilyard at iol.unh.edu
Thu Apr 7 23:47:06 CEST 2022
From: Owen Hilyard <ohilyard at 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 at 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
diff --git a/app/meson.build b/app/meson.build
index 93d8c15032..3dfd5c003e 100644
--- a/app/meson.build
+++ b/app/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
diff --git a/app/test-pmd-api/meson.build b/app/test-pmd-api/meson.build
new file mode 100644
index 0000000000..7438098e9d
--- /dev/null
+++ b/app/test-pmd-api/meson.build
@@ -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 at .pb.cc', '@BASENAME at .pb.h', '@BASENAME at .grpc.pb.cc', '@BASENAME at .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 at _pb2.py', '@BASENAME at _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
--
2.30.2
More information about the dev
mailing list