dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.68k stars 320 forks source link

gen: allow for cfg_evaluator to be set in cxx_gen #1334

Closed ahayzen-kdab closed 2 months ago

ahayzen-kdab commented 3 months ago

This allows for users of cxx_gen to choose a cfg_evaluator, otherwise they cannot have cfg attributes in bridges.

ahayzen-kdab commented 3 months ago

When using cxx_gen::generate_header_and_cc https://docs.rs/cxx-gen/latest/cxx_gen/fn.generate_header_and_cc.html we can supply an Opt but the cfg_evaluator is not public and it defaults to UnsupportedCfgEvaluator.

This means that when using just cxx_gen you cannot support #[cfg(...)] in CXX bridges, by making this field public we can then set our own evaluator and support cfg attributes in bridges.

dtolnay commented 2 months ago

Published in cxx-gen 0.7.121.