https://github.com/ultimaker/curaengine_grpc_definitions
https://github.com/ultimaker/curaengine_grpc_definitions
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ultimaker/curaengine_grpc_definitions
- Owner: Ultimaker
- License: mit
- Created: 2023-05-17T12:17:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-07T16:20:06.000Z (9 months ago)
- Last Synced: 2025-10-03T02:50:28.470Z (9 months ago)
- Language: Python
- Size: 646 KB
- Stars: 0
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gRPC definitions for CuraEngine
This repository contains the gRPC proto definitions for CuraEngine. These definitions are used to generate the gRPC code for the CuraEngine gRPC plugin system.
## Overview
As part of the [CuraEngine](https://github.com/Ultimaker/CuraEngine) plugin system, the CuraEngine serves as gRPC client. The functionality of CuraEngine can be extended with CuraEngine plugins, which behaves as servers. The gRPC client/server uses the [Protocol Buffers](https://developers.google.com/protocol-buffers) format. This repository contains the definitions for the gRPC server and client(s).
## Usage
The gRPC definitions are available for the following languages:
Conan
Usage in `conanfile.py`
```python
class CuraEnginePluginConan(ConanFile):
...
def requirements(self):
self.requires("asio-grpc/2.4.0")
self.requires("curaengine_grpc_definitions/(latest)@ultimaker/testing")
...
def generate(self):
tc = CMakeToolchain(self)
cpp_info = self.dependencies["curaengine_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`
```cmake
...
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 ...)
...
```
See: https://github.com/Ultimaker/Cura/wiki/Running-Cura-from-Source#1-configure-conan how to configure Conan
```bash
conan install . --build=missing --update
```
Python
```bash
pip install git+https://github.com/Ultimaker/CuraEngine_grpc_definitions.git
```
```python
import grpc
from CuraEngineGRPC.cura_pb2_grpc import CuraStub
import CuraEngineGRPC.cura_pb2 as cura_pb
....
```
Rust
Required dependencies before the gRPC definitions can be used are: [`protoc`, `protobuf`](https://github.com/hyperium/tonic#dependencies).
Then add the following package to your `Cargo.toml`:
```bash
cargo add --git https://github.com/Ultimaker/curaengine_grpc_definitions.git
```
## License
This project is licensed under the [MIT license](LICENSE).