From 3ebf0c6029961a96686c1bc639b9228b58d729d0 Mon Sep 17 00:00:00 2001 From: Nitin Saxena Date: Fri, 13 Dec 2024 20:34:54 +0530 Subject: [PATCH] dep: add grpc as build dependency detect re2, protoc, grpc_cpp_plugin, protobuf library and add grpc build dependencies Individual lib or app can use GRPC as follows for library use: lib_deps += DAO_EXT_DEPS_GRPC for application use: app_deps += DAO_EXT_DEPS_GRPC Signed-off-by: Nitin Saxena Change-Id: I5cabd877461000d8a8ed1dcce8a39a27bf3bd8f0 Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/141618 Reviewed-by: Ashwin Sekhar T K Tested-by: sa_ip-toolkits-Jenkins --- ci/build/config/arm64_cn10k_linux_gcc | 2 +- config/arm64_cn10k_linux_gcc | 2 +- dep/grpc/meson.build | 37 +++++++++++++++++++++++++++ dep/meson.build | 1 + meson.build | 6 +++-- 5 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 dep/grpc/meson.build diff --git a/ci/build/config/arm64_cn10k_linux_gcc b/ci/build/config/arm64_cn10k_linux_gcc index 7e71a4a..63dec4e 100644 --- a/ci/build/config/arm64_cn10k_linux_gcc +++ b/ci/build/config/arm64_cn10k_linux_gcc @@ -1,6 +1,6 @@ [binaries] c = ['ccache', 'aarch64-marvell-linux-gnu-gcc'] -cpp = ['ccache', 'aarch64-marvell-linux-gnu-cpp'] +cpp = ['ccache', 'aarch64-marvell-linux-gnu-g++'] ar = 'aarch64-marvell-linux-gnu-gcc-ar' strip = 'aarch64-marvell-linux-gnu-strip' pkgconfig = 'pkg-config' diff --git a/config/arm64_cn10k_linux_gcc b/config/arm64_cn10k_linux_gcc index 36e2d8d..bf0a663 100644 --- a/config/arm64_cn10k_linux_gcc +++ b/config/arm64_cn10k_linux_gcc @@ -1,6 +1,6 @@ [binaries] c = ['ccache', 'aarch64-marvell-linux-gnu-gcc'] -cpp = ['ccache', 'aarch64-marvell-linux-gnu-cpp'] +cpp = ['ccache', 'aarch64-marvell-linux-gnu-g++'] ar = 'aarch64-marvell-linux-gnu-gcc-ar' strip = 'aarch64-marvell-linux-gnu-strip' pkgconfig = 'pkg-config' diff --git a/dep/grpc/meson.build b/dep/grpc/meson.build new file mode 100644 index 0000000..2a1891c --- /dev/null +++ b/dep/grpc/meson.build @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: Marvell-MIT +# Copyright (c) 2025 Marvell. + +protoc = find_program('protoc', required:false) +grpc_cpp_plugin = find_program('grpc_cpp_plugin', required:false) +re2_dep = dependency('re2', method : 'pkg-config', version: '>=11.0.0', required:false) +grpcplus_dep = dependency('grpc++', method : 'pkg-config', version: '>=1.65.0', required:false) +protobuf_dep = dependency('protobuf', method : 'pkg-config', version:'>=27.2.0', required:false) + +if not protoc.found() + message('protobuf compiler (protoc) not found') + subdir_done() +endif + +if not grpc_cpp_plugin.found() + message('grpc_cpp_plugin not found') + subdir_done() +endif + +if not re2_dep.found() + message('re2 not found') + subdir_done() +endif + +if not protobuf_dep.found() + message('protobuf pkgconfig not exported') + subdir_done() +endif + +if not grpcplus_dep.found() + message('grpcplus pkgconfig not exported') + subdir_done() +endif + +DAO_BUILD_CONF.set('DAO_GRPC_DEP', '1') +DAO_EXT_DEPS_GRPC += grpcplus_dep +DAO_EXT_DEPS_GRPC += protobuf_dep diff --git a/dep/meson.build b/dep/meson.build index c838d48..415761a 100644 --- a/dep/meson.build +++ b/dep/meson.build @@ -3,3 +3,4 @@ subdir('dpdk') subdir('libnl') +subdir('grpc') diff --git a/meson.build b/meson.build index 943a0f5..a86651f 100644 --- a/meson.build +++ b/meson.build @@ -3,11 +3,11 @@ project( 'Data Accelerator Offload', - 'C', + 'C', 'CPP', meson_version: '>= 0.61.0', version: run_command(find_program('cat', 'more'), files('VERSION'), check: true).stdout().strip(), - default_options: ['warning_level=2', 'werror=true', 'buildtype=release'] + default_options: ['warning_level=2', 'werror=true', 'buildtype=release','cpp_std=c++17'] ) # Build Configuration Data @@ -21,6 +21,8 @@ DAO_INCLUDES = [] DAO_EXT_DEPS_LIBDPDK = [] # LIBNL DAO_EXT_DEPS_LIBNL = [] +# GRPC +DAO_EXT_DEPS_GRPC = [] # DAO static libraries DAO_STATIC_LIBS = [] # Enabled/disabled static dao applicaitons/libraries/tests