mcpplibs.grpcgen
importprotoc + grpc_cpp_plugin codegen as an importable mcpp build rule (host-module)
import grpcgen;
Module name read from the upstream `export module` declaration in src/grpcgen.cppm.
mcpp add mcpplibs.grpcgen@1.83.0
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Asserts the generated stubs exist, compile and carry the SERVICE — a
// protobuf-only run would produce echo.pb.* and no Echo::Service, so a
// half-configured codegen cannot pass this.
//
// HAVE_GRPC comes from this project's own cfg-gated cxxflags: the package is
// linux/macOS-only, so elsewhere this file is an empty main().
#ifdef HAVE_GRPC
#include <cstdio>
#include <string>
#include "echo.pb.h"
#include "echo.grpc.pb.h"
int main() {
// The message half: a real generated type, round-tripped.
echotest::EchoRequest req;
req.set_text("mcpp");
std::string wire;
if (!req.SerializeToString(&wire)) return 1;
echotest::EchoRequest back;
if (!back.ParseFromString(wire)) return 1;
// …
tests/examples/grpc-codegen/tests/codegen.cpp · project tests/examples/grpc-codegen
Build · upstream manifest
- modules
grpcgen- targets
grpcgen (lib)- language
c++23- manifest version
1.83.0- source
https://raw.githubusercontent.com/mcpplibs/grpc-m/v1.83.0-4/rules/mcpp.toml