A Base of a Cargo crate with cxx already configured.
The build-cxx repository is a base template for creating Rust libraries that can be integrated with C++ projects. This setup includes necessary configurations for Rust and C++ interoperation using the cxx
crate.
- Rust: Install Rust
- C++ compiler: Ensure you have a compatible C++ compiler installed
To clone the repository with the bin
tag, use the following command:
git clone --branch bin --depth 1 https://github.com/MoutOgm/build-cxx.git
cd build-cxx
To clone the repository with the lib
tag, use the following command:
git clone --branch lib --depth 1 https://github.com/MoutOgm/build-cxx.git
cd build-cxx
If you are cloning this repository into an existing Git repository, remove the .git directory:
rm -rf build-cxx/.git*
Ensure you have the following dependencies specified in your Cargo.toml
file:
[dependencies]
cxx = "1.0.129"
[build-dependencies]
cxx-build = "1.0.129"
To build the project, use Cargo:
cargo build --release
To run the project, use:
cargo run
Use cxx
to integrate Rust with your C++ codebase. Refer to the cxx
documentation for more details on how to set this up.