Bindings¶
- Author:
Rohit Goswami
Python (maturin)¶
The Python package eindir ships from PyPI as a maturin-built wheel.
The Rust extension is exposed as the submodule eindir._core.
The package source lives at python/eindir/ in the repo and is installed via maturin develop --features python during development.
C and C++ (cargo-c)¶
The Rust crate produces a cdylib, staticlib, generated header eindir-core.h, and pkg-config metadata eindir-core.pc via cargo-c.
cargo cinstall --release --prefix /usr/local
pkg-config --cflags --libs eindir-core
A hand-written companion header eindir-core.hpp wraps the C declarations in namespace eindir for ergonomic C++ usage.
Build-system glue¶
Meson¶
eindir_core_dep = dependency('eindir-core')
executable('myprog', 'main.cpp', dependencies: eindir_core_dep)
CMake¶
find_package(PkgConfig REQUIRED)
pkg_check_modules(EINDIR_CORE REQUIRED IMPORTED_TARGET eindir-core)
target_link_libraries(myprog PRIVATE PkgConfig::EINDIR_CORE)