Starlark-based build systems with the ability to compile a code generator and
invoke it as a genrule will run CXX's C++ code generator via its cxxbridge
command line interface.
The tool is packaged as the cxxbridge-cmd crate on crates.io or can be built
from the gen/cmd/ directory of the CXX GitHub repo.
Important: The version number of cxxbridge-cmd used for the C++ side of
the binding must always be identical to the version number of cxx used for the
Rust side. You must use some form of lockfile or version pinning to ensure that
this is the case.
The CXX repo maintains working BazelBUILD.bazel and Buck2BUCK targets
for the complete blobstore tutorial (chapter 3) for your reference, tested in
CI. These aren't meant to be directly what you use in your codebase, but serve
as an illustration of one possible working pattern.