Short update: WrapVTK is awesome! It provides me with a lot of information and i will probably not need to extract any more information as far as I can tell right now. I have chosen to tackle the following individual problems in order to completely generate the bindings from scratch.
- Generate xml data using WrapVTK
- Parse xml data
- Construct inheritance hierarchy for all classes in all modules
- Identify traits as non-inherited public methods
- Define 1:1 conversion between
C++
and Rust types- Remove/Treat modifiers such as
const
orunsigned
- Destructure Generics
std::array<float, 3>
ā[f32; 3]
- Treat positioning of pointers/references
- Remove/Treat modifiers such as
- Generate Code for ffi and traits
- Generate
C++
code which can be wrapped in Rust - Generate
CMakeLists
file - Determine linker args
- Generate Rust ffi glue and implementation code
- Generate
In particular point 5. seems to be a tough nut to crack since it requires me to partially parse the C++
types. I have though about using libclang
to handle some of the parsing but right now it seems like more work and I would only need a very minor subset of their functionality.
In the future I will also have to decide how to publish the generated code. I will probably provide crates with corresponding version numbers (i.e. vtk-rs094
, vtk-rs091
) and also provide the tool wrap-vtk
which can generate the bindings as a separate crate.