Cannot #include gen.rs.h
reliably when building with cargo due to dynamic out location
#213
Labels
cargo
Issues affecting Cargo-based use of cxx
Thanks for cxx!
It seems that the location of the generated bridge files varies based on the method with which the crate is added as dependency. E.g. in the crate keytar I've used
#include "src/lib.rs.h"
, which works fine while working directly in the crate, since thers.h
file ends up inTARGET_DIR/cxxbridge/src/lib.rs.h
. When adding the crate asdependency
(ends up inTARGET_DIR/cxxbridge/.cargo/..
) or including it viapath
(ends up in nested paths depending on the local directory name), the out location changes in unpredictable ways, which makes it hard (impossible?) to reliably#include
it.My naive approach to fix this would be to always write the given include path as-is to the
OUT_DIR
and make it an requirement to include that (or automatically include it as part ofcxx_build::bridge
).Maybe I'm missing something obvious and it is possible to reliably define
#include
s for cargo, in which case I'd appreciate pointers. Thanks!The text was updated successfully, but these errors were encountered: