diff options
| author | allen <[email protected]> | 2023-06-26 18:38:17 +0800 |
|---|---|---|
| committer | allen <[email protected]> | 2023-06-27 23:52:37 +0800 |
| commit | 8ce4384fab8a343c4f5abe3ecf9456694b2c1d42 (patch) | |
| tree | ee12ee3db368a93c81ffcd787926334942fe6654 /tests/projects/c++/protobuf_grpc_cpp_plugin | |
| parent | 649faaf87d7cb1eab632d89be89fc12ebfe4e3a2 (diff) | |
support grpc_cpp_plugin #3148
Diffstat (limited to 'tests/projects/c++/protobuf_grpc_cpp_plugin')
4 files changed, 55 insertions, 0 deletions
diff --git a/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp new file mode 100644 index 000000000..dc06458ae --- /dev/null +++ b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp @@ -0,0 +1,11 @@ +#include <iostream> +#include "test.pb.h" +#include "subdir/test2.pb.h" + +using namespace std; + +int main(int argc, char** argv) +{ + cout << "hello world!" << endl; + return 0; +} diff --git a/tests/projects/c++/protobuf_grpc_cpp_plugin/src/subdir/test2.proto b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/subdir/test2.proto new file mode 100644 index 000000000..811cdac3e --- /dev/null +++ b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/subdir/test2.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package test2; +message TestCase2 { + string name2 = 4; +} +message Test2 { + repeated TestCase2 case2 = 1; +} diff --git a/tests/projects/c++/protobuf_grpc_cpp_plugin/src/test.proto b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/test.proto new file mode 100644 index 000000000..d486ef316 --- /dev/null +++ b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/test.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +import "subdir/test2.proto"; +package test; +message TestCase { + string name = 4; +} +message Test { + repeated TestCase case = 1; + repeated test2.TestCase2 case2 = 2; +} + +message EchoRequest { + string data = 1; +} + +message EchoResponse { + string data = 1; +} + +service EchoServer { + rpc Echo(EchoRequest) returns (EchoResponse); +} diff --git a/tests/projects/c++/protobuf_grpc_cpp_plugin/xmake.lua b/tests/projects/c++/protobuf_grpc_cpp_plugin/xmake.lua new file mode 100644 index 000000000..a38d19d6c --- /dev/null +++ b/tests/projects/c++/protobuf_grpc_cpp_plugin/xmake.lua @@ -0,0 +1,14 @@ +add_rules("mode.debug", "mode.release") +add_requires("protobuf-cpp") +add_requires("grpc", {system = false}) + +target("test") + set_kind("binary") + set_languages("c++17") + add_packages("protobuf-cpp") + add_packages("grpc") + add_rules("protobuf.cpp") + add_files("src/*.cpp") + add_files("src/test.proto", {proto_rootdir = "src", proto_grpc_cpp_plugin = true}) + add_files("src/subdir/test2.proto", {proto_rootdir = "src"}) + |
