rpc框架之thrift、grpc

thrift

https://gitee.com/apache/thrift.git
依赖boost,设置Boost_INCLUDE_DIR路径,cmake_warn比较多(可以忽略)

set(Boost_INCLUDE_DIR D:\Opensource\boost_1_78_0)
include(BoostMacros)

build/cmake/thriftmarcos.cmake中修改,输出静态库lib

ADD_LIBRARY_THRIFT
add_library(${name} STATIC ${ARGN})
cmakelists.txt中添加add_definitions(“-DTHRIFT_STATIC_DEFINE”)

service CallService {
 	string Process(1:string file,2:string value)
}

thrift编译idl文件,输出对应语言类型代码,输出到gen-cpp文件中

thrift --gen cpp a.thrift

rpc框架之thrift、grpc_第1张图片

thrift --gen java a.thrift //java
thrift --gen netstd a.thrift //c#<

你可能感兴趣的:(框架学习,rpc,java,网络协议)