From 722571ce6a161f38c8b949a95137ea425347ec7e Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Wed, 23 Oct 2024 10:29:01 -0600 Subject: [PATCH] Add example Cargo.toml and build.rs for exposing pyo3 cfgs --- pyo3-ffi/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pyo3-ffi/src/lib.rs b/pyo3-ffi/src/lib.rs index c6157401124..48028d53426 100644 --- a/pyo3-ffi/src/lib.rs +++ b/pyo3-ffi/src/lib.rs @@ -48,6 +48,22 @@ //! - `Py_LIMITED_API`: Marks code enabled when the `abi3` feature flag is enabled. //! - `PyPy` - Marks code enabled when compiling for PyPy. //! +//! Add [`pyo3-build-config`] as a build dependency in your `Cargo.toml`: +//! +//! ```toml +//! [build-dependency] +//! pyo3-build-config = "VER" +//! ``` +//! +//! And then either create a new `build.rs` file in the project root or modify +//! the existing `build.rs` file to call `use_pyo3_cfgs()`: +//! +//! ```rust +//! fn main() { +//! pyo3_build_config::use_pyo3_cfgs(); +//! } +//! ``` +//! //! # Minimum supported Rust and Python versions //! //! `pyo3-ffi` supports the following Python distributions: