(Maybe?) port binding generator to Rust libclang
The current binding generator in C++ is hard to compile and use, which increases friction if we want to upgrade PhysX version of expose more functionality.
I tried using the approximately equivalent Python libclang bindings to regenerate a 1:1 match of the current output but found that some info was missing around inheritance and fields, which would've lead to a complete breakage of physx-sys, which would be a hard sell.
We should investigate whether the Rust libclangd can be used to generate a more similar version of the bindings and struct-tests.
Has bindgen been looked at? It can generate C++ bindings with the major restrictions being around templates.
Ping @h3r2tic, who wrote the current impl. Did you investigate that?
Yup! It was the first thing I tried, and at least back then bindgen gave up on most of PhysX. I don't think it had any way of handling ABI differences between platforms either.
Digging into bindgen for C++ a bit more, this issue pops out because physx-sys had an issue like that, as well as an issue similar to what @tgolsson encountered with fields. This PR proposes changing bindgen from libclang to libtooling to resolve those issues because the latter exposes the information necessary to generate bindings appropriately, but it appears to have stalled. One of the issues raised on that PR was build difficulties, like the ones raised in this issue. The issues @h3r2tic mentioned are fixable via a pretty hefty bindings.h but that may be preferable to duplicating translation code.
Another option is generating a cxx::bridge, perhaps using bindgen since cxx has at least some support for that. However, cxx is still somewhat immature so I'm not sure how viable it is for something as beefy as PhysX.
#183 transitioned pxbind to a Rust project that just clang's AST JSON output, much easier and no requirements on big clunky libraries.