legokichi / pigpio-sys

Rust binding for libpigpio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pigpio-sys

Rust FFI wrapper to libpigpio.

Build

cargo build

Environment variables

Some parameters are used in build.rs.

  • LIBCLANG_INCLUDE_PATH: Path to the target system header directory
  • LIBPIGPIO_LIB_PATH: Path to the pigpio library
  • LIBPIGPIO_INCLUDE_PATH: Path to the pigpio header file

Cross build

For cross compiling, some more configurations are required.

Example (build for raspberrypi)

If docker is used, call following command:

docker-compose run --rm cross-builder

or building manually:

pigpio-sys$ cat <<EOF > .cargo/config
[target.arm-unknown-linux-gnueabihf]
linker = "arm-rpi-linux-gnueabihf-gcc"
rustflags = ["-C", "link-args=-Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf"]
EOF
pigpio-sys$ export LIBCLANG_INCLUDE_PATH=/usr/include/clang/7/include
pigpio-sys$ export LIBPIGPIO_LIB_PATH=/path/to/lib
pigpio-sys$ export LIBPIGPIO_INCLUDE_PATH=/path/to/include
pigpio-sys$ cargo build --examples --target=arm-unknown-linux-gnueabihf

Required package

  • libpigpio1
  • libpigpio-dev
  • libclang-7-dev

About

Rust binding for libpigpio

License:MIT License


Languages

Language:Rust 56.2%Language:Shell 35.7%Language:Dockerfile 7.5%Language:C 0.6%