This repository contains the gRPC proto definitions for CuraEngineLE. These definitions are used to generate the gRPC code for the CuraEngineLE gRPC plugin system.
As part of the CuraEngineLE plugin system, the CuraEngineLE serves as gRPC client. The functionality of CuraEngineLE can be extended with CuraEngine plugins, which behaves as servers. The gRPC client/server uses the Protocol Buffers format. This repository contains the definitions for the gRPC server and client(s).
The gRPC definitions are available for the following languages:
Usage in conanfile.py
class CuraEngineLEPluginConan(ConanFile):
...
def requirements(self):
self.requires("asio-grpc/2.4.0")
self.requires("curaenginele_grpc_definitions/(latest)@lulzbot/testing")
...
def generate(self):
tc = CMakeToolchain(self)
cpp_info = self.dependencies["curaenginele_grpc_definitions"].cpp_info
tc.variables["GRPC_IMPORT_DIRS"] = cpp_info.resdirs[0]
tc.variables["GRPC_PROTOS"] = ";".join([str(p).replace("\\", "/") for p in Path(cpp_info.resdirs[0]).rglob("*.proto")])
tc.generate()
...Usage in CMakeLists.txt
...
find_package(asio-grpc REQUIRED)
asio_grpc_protobuf_generate(PROTOS "${GRPC_PROTOS}"
IMPORT_DIRS ${GRPC_IMPORT_DIRS}
OUT_VAR "ASIO_GRPC_PLUGIN_PROTO_SOURCES"
OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated"
GENERATE_GRPC GENERATE_MOCK_CODE)
add_executable(engine_plugin_target_name ${PROTO_SRCS} ${ASIO_GRPC_PLUGIN_PROTO_SOURCES} main.cpp ...)
target_include_directories(engine_plugin_target_name
PUBLIC
...
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/generated
)
target_link_libraries(simplify_boost_plugin PUBLIC asio-grpc::asio-grpc ...)
...conan install . --build=missing --updatepip install git+https://github.com/lulzbot3d/CuraEngineLE_gRPC_Definitions.gitimport grpc
from CuraEngineGRPC.cura_pb2_grpc import CuraStub
import CuraEngineGRPC.cura_pb2 as cura_pb
....Required dependencies before the gRPC definitions can be used are: protoc, protobuf.
Then add the following package to your Cargo.toml:
cargo add --git https://github.com/lulzbot3d/CuraEngineLE_gRPC_Definitions.git