DPDK patches and discussions
 help / color / mirror / Atom feed
From: ohilyard@iol.unh.edu
To: dev@dpdk.org
Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net,
	Owen Hilyard <ohilyard@iol.unh.edu>
Subject: [PATCH v1 2/4] app/test-pmd-api: Add POC with gRPC deps
Date: Thu,  7 Apr 2022 17:47:06 -0400	[thread overview]
Message-ID: <20220407214707.29730-3-ohilyard@iol.unh.edu> (raw)
In-Reply-To: <20220407214707.29730-1-ohilyard@iol.unh.edu>

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

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@.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
-- 
2.30.2


  parent reply	other threads:[~2022-04-07 21:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 21:47 [PATCH v1 0/4] [RFC] Testpmd RPC API ohilyard
2022-04-07 21:47 ` [PATCH v1 1/4] app/test-pmd-api: Add C++ Compiler ohilyard
2023-10-02 18:33   ` Stephen Hemminger
2022-04-07 21:47 ` ohilyard [this message]
2022-04-07 21:47 ` [PATCH v1 3/4] app/test-pmd-api: Add protobuf file ohilyard
2022-04-07 21:47 ` [PATCH v1 4/4] app/test-pmd-api: Implementation files for the API ohilyard
2022-04-11 14:27 ` [PATCH v1 0/4] [RFC] Testpmd RPC API Jerin Jacob
2022-04-11 17:48   ` Owen Hilyard
2022-04-12  6:07     ` Jerin Jacob
2022-04-13 12:47       ` Owen Hilyard
2022-04-14 12:07         ` Ananyev, Konstantin
2022-04-14 20:09           ` Owen Hilyard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220407214707.29730-3-ohilyard@iol.unh.edu \
    --to=ohilyard@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).