Skip to main content

Crate hyperscan_src

Crate hyperscan_src 

Source
Expand description

hyperscan-src: 将 intel/hyperscan C++ 源码打包为 Rust crate,通过 cmake 从源码编译。

§设计原理

本 crate 使用 openssl-src 模式:cmake 调用放在 lib.rs 而非 build.rs。 原因:将 cmake 调用放入 lib.rs 后,下游 crate(hypervectorscan-sys)在其 build.rs 中通过函数调用执行。此时所有 cargo:rustc-link-* 指令都在 hypervectorscan-sys 的 build script 进程内发出 → Cargo 能正确将这些链接指令应用到最终产物。

如果放在本 crate 的 build.rs,link 指令会因为 crate 间隔离而无法传递到最终二进制。

§系统依赖

编译本 crate 需要:

  • cmake ≥ 3.x
  • C++ 编译器(gcc / clang)
  • ragel
  • boost-dev

这些依赖仅在启用 vendored feature 时需要。缺少时 cmake 的 configure 阶段会报错, 错误信息会通过 cargo 输出清晰的提示。

Structs§

Artifacts
构建产物路径信息
Build
构建配置