https://github.com/andyblarblar/serialcxx
A (WIP) port of Rust's serialport library to C++
https://github.com/andyblarblar/serialcxx
Last synced: 3 months ago
JSON representation
A (WIP) port of Rust's serialport library to C++
- Host: GitHub
- URL: https://github.com/andyblarblar/serialcxx
- Owner: andyblarblar
- Created: 2021-11-06T05:33:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T06:34:58.000Z (about 3 years ago)
- Last Synced: 2023-03-10T09:17:30.891Z (about 2 years ago)
- Language: Rust
- Homepage:
- Size: 82 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Rusty cmake
Integrate Rust in a Cmake project with [Corrosion](https://github.com/AndrewGaspar/corrosion) and [Cxx](https://github.com/dtolnay/cxx).
## Usage
`Rust_CARGO_TARGET` needs to be defined before calling `add_library_rust`, which takes a `PATH` to the root of a rust crate along with a required `NAMESPACE` to use for the created target.
`add_library_rust(PATH some/path/to/rustycrate NAMESPACE my)` will result in a target `my::rustycrate` that includes both the crate itself and the generated cxxbridge header and source to be linked into another target.## Windows + Clang issue
Building with Clang on Windows in debug mode creates a mismatch between the c runtime being dynamic release for the rust lib and dynamic debug for cpp code.
No clean solution have been found to this issue. Using the -gnu target on Windows for the Rust lib and building with mingw bypasses this.## Other notes
- This has only been tested with calling Rust from Cpp, and not the other way around.
- For some reason the `lib.rs.cpp' file gets compliled twice, not sure why.
- Clean up how the bindings are placed `#include "rustycrate/src/lib.rs.h"` is a bit ugly.