Browse Source

adding the `operator_types.h` required for c operator compilation

tags/v0.2.0-rc
haixuanTao 2 years ago
parent
commit
e6b1bcf08d
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      binaries/cli/src/template/c/mod.rs

+ 8
- 4
binaries/cli/src/template/c/mod.rs View File

@@ -53,7 +53,8 @@ fn create_dataflow(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrR

fn create_operator(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrReport> {
const OPERATOR: &str = include_str!("operator/operator-template.c");
const HEADER: &str = include_str!("../../../../../apis/c/operator/operator_api.h");
const HEADER_API: &str = include_str!("../../../../../apis/c/operator/operator_api.h");
const HEADER_TYPE: &str = include_str!("../../../../../apis/c/operator/operator_types.h");

if name.contains('/') {
bail!("operator name must not contain `/` separators");
@@ -73,9 +74,12 @@ fn create_operator(name: String, path: Option<PathBuf>) -> Result<(), eyre::ErrR
let operator_path = root.join("operator.c");
fs::write(&operator_path, OPERATOR)
.with_context(|| format!("failed to write `{}`", operator_path.display()))?;
let header_path = root.join("operator_api.h");
fs::write(&header_path, HEADER)
.with_context(|| format!("failed to write `{}`", header_path.display()))?;
let header_api_path = root.join("operator_api.h");
let header_type_path = root.join("operator_types.h");
fs::write(&header_api_path, HEADER_API)
.with_context(|| format!("failed to write `{}`", header_api_path.display()))?;
fs::write(&header_type_path, HEADER_TYPE)
.with_context(|| format!("failed to write `{}`", header_type_path.display()))?;

// TODO: Makefile?



Loading…
Cancel
Save