mcpp index

mcpplibs.grpcgen

import

protoc + grpc_cpp_plugin codegen as an importable mcpp build rule (host-module)

import grpcgen;

模組名讀自上游 src/grpcgen.cppm 裡的 `export module` 宣告。

mcpp add mcpplibs.grpcgen@1.83.0

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

// 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 · 專案 tests/examples/grpc-codegen

建置 · 上游資訊清單

modules
grpcgen
targets
grpcgen (lib)
language
c++23
manifest version
1.83.0
來源
https://raw.githubusercontent.com/mcpplibs/grpc-m/v1.83.0-4/rules/mcpp.toml

版本

版本平台 鏡像sha256
1.83.0 最新 LinuxWindowsmacOS CN GLOBAL 991e9928e0fd…