Skip to content

An example of how to use the CMake crate in conjunction with rust-bindgen for integrating vendored C/C++ libraries with rust

Notifications You must be signed in to change notification settings

paigeadelethompson/rust_bindgen_and_nested_cmake_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Preface

I needed to create this to prove to myself that it is possible (it is) so if this helps then I'm glad. As you might expect, a library wraps a bindings library which contains the C/C++/CMake project:

.
├── Cargo.lock
├── Cargo.toml
├── hello_lib
│   ├── Cargo.lock
│   ├── Cargo.toml
│   ├── libhello_bindings
│   │   ├── Cargo.lock
│   │   ├── Cargo.toml
│   │   ├── build.rs
│   │   ├── libhello
│   │   │   ├── CMakeLists.txt
│   │   │   ├── hello.c
│   │   │   └── proto.h
│   │   └── src
│   │       └── lib.rs
│   └── src
│       └── lib.rs
└── src
    └── main.rs

the file build.rs is responsible for first executing the CMake build as well as generating the Rust FFI bindings which are used (and tested with cargo test) in the hello_lib sub-crate.

Info

About

An example of how to use the CMake crate in conjunction with rust-bindgen for integrating vendored C/C++ libraries with rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published