Code Monkey home page Code Monkey logo

libcec-sys's Introduction

libcec-sys

Crates.io Docs.rs CI

FFI bindings for the libcec

Linking to system libcec

This crate works with libcec v4.x, v5.x and v6.x (latest version as time of writing). During the build we try to find libcec system library installation using pkg-config and compilation using default C compiler (cc crate). As a fallback, vendored libcec (v6.x) is used during the build.

Alternatively, one can the decide to skip logic above and force the use of vendored sources by enabling vendored feature.

The crate is tested mainly with Linux and Windows but could work with other platforms as well. PRs welcome.

Linux (general)

On Linux, for most convenient build process, it is recommended to install pkg-config, libcec-dev (headers and pkg-config configuration), libcec6 (dynamic library), libp8-platform-dev and libp8-platform2 from your package distribution before installing this crate. Exact package names vary between distributions and package managers.

In addition libudev-dev might be needed.

With debian based distributions, you can simply

sudo apt-get install libudev-dev libp8-platform2 libp8-platform-dev libcec-dev pkg-config libcec6

Raspberry Pi OS

If you are using Raspberry Pi OS and want to use the built-in HDMI port CEC, you might need to build the libcec yourself, since the libcec as packaged by debian is not providing the driver (as of 2022)

Adapted from libcec documentation:

# Become superuser
sudo su

# Remove libcec (since we are going to build it ourselves)
apt-get remove libcec6

# Install libcec build dependencies, but not libcec itself
apt-get install libp8-platform-dev libp8-platform2 cmake libudev-dev libxrandr-dev python3-dev swig git

# Build libcec 6.0.2 with RPI CEC driver enabled
rm -rf /tmp/libcec-build-tmp
mkdir /tmp/libcec-build-tmp
cd /tmp/libcec-build-tmp
git clone --recursive https://github.com/Pulse-Eight/libcec.git
cd libcec
git checkout libcec-6.0.2
mkdir build
cd build
cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..
make -j4
make install
ldconfig

# Leave superuser context
exit

Windows

On Windows, it is recommended to install libcec via the installer and add cec.dll to the PATH environment variable.

For a vendored build, libcec-sys will dynamically link to the compiled cec.dll. This means you must package your standalone executable with the compiled dynamic library.

Vendored Build Prerequisites:

  • Visual Studio 2019 w/ Desktop Development with C++ and Universal Windows Platform development
  • CMake 3.12+
  • Python 3.6+ with Debug Binaries

License

This repo contains content distributed under three different licenses.

  1. Main package, licensed under GNU General Public License version 2, (LICENSE or https://opensource.org/licenses/GPL-2.0)

  2. The CI/CD setup in .github/ is based on rust-github/template, and therefore licensed under either of

    at your option.

  3. The CI uses sccache build cache tooling as shared in Cross repository wiki. The Cross repo itself is licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.

Releasing

cargo release --no-publish --dev-version --execute and let the github CD pipeline do the rest.

libcec-sys's People

Contributors

ok-nick avatar opeik avatar skraus-dev avatar ssalonen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.