#cpp #tools #build #script #c #to

cpp_to_rust_build_tools

Build script implementation for C++ library wrappers

6 releases

Uses old Rust 2015

0.2.3 Oct 7, 2017
0.2.1 Jun 12, 2017
0.2.0 May 21, 2017
0.1.0 Dec 21, 2016
0.0.0 Dec 21, 2016
Download history 11/week @ 2021-06-28 8/week @ 2021-07-05 11/week @ 2021-07-12 18/week @ 2021-07-19 14/week @ 2021-07-26 22/week @ 2021-08-02 13/week @ 2021-08-09 10/week @ 2021-08-16 8/week @ 2021-08-23 1/week @ 2021-08-30 5/week @ 2021-09-06 5/week @ 2021-09-13 5/week @ 2021-09-20 9/week @ 2021-09-27 6/week @ 2021-10-04 10/week @ 2021-10-11

55 downloads per month
Used in qt_build_tools

MIT license

69KB
1.5K SLoC

cpp_to_rust_build_tools

Build script implementation for C++ library wrappers.

Online documentation

Crates generated by cpp_to_rust_generator require multiple custom build operations:

  • Apply extra build configuration passed via environment variables (CPP_TO_RUST_LIB_PATHS, CPP_TO_RUST_FRAMEWORK_PATHS, CPP_TO_RUST_INCLUDE_PATHS);
  • Select active build configuration based on current target;
  • Build the C++ wrapper library;
  • Generate ffi.rs file with actual linking attributes;
  • Determine sizes of C++ types with stack allocation place;
  • Print cargo attributes required for linking the crate.

It appears a common task to perform other custom operations in the build script, so all the above operations are implemented as a separate crate (cpp_to_rust_build_tools) which is used as build dependency of the default generated build script. If a custom build script is defined, it should use this crate's API to perform the necessary build operations.

See README of the repository root for more information about other parts of the project.

Dependencies

~7MB
~167K SLoC