Skip to content

Commit 60a0db6

Browse files
committed
build: restore PYO3_CROSS variable
1 parent 6abd255 commit 60a0db6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ fn cross_compiling() -> Result<Option<CrossCompileConfig>> {
145145
let target_vendor = cargo_env_var("CARGO_CFG_TARGET_VENDOR");
146146
let target_os = cargo_env_var("CARGO_CFG_TARGET_OS");
147147

148-
if cross_lib_dir.is_none() && cross_python_version.is_none() {
148+
if env_var("PYO3_CROSS").is_none() && cross_lib_dir.is_none() && cross_python_version.is_none()
149+
{
149150
// No cross-compiling environment variables set; try to determine if this is a known case
150151
// which is not cross-compilation.
151152

guide/src/building_and_distribution.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ See [github.com/japaric/rust-cross](https://github.com/japaric/rust-cross) for a
9090

9191
After you've obtained the above, you can build a cross compiled PyO3 module by setting a few extra environment variables:
9292

93+
* `PYO3_CROSS`: If present this variable forces PyO3 to configure as a cross-compilation.
9394
* `PYO3_CROSS_LIB_DIR`: This variable must be set to the directory containing the target's libpython DSO and the associated `_sysconfigdata*.py` file for Unix-like targets, or the Python DLL import libraries for the Windows target.
9495
* `PYO3_CROSS_PYTHON_VERSION`: Major and minor version (e.g. 3.9) of the target Python installation. This variable is only needed if PyO3 cannot determine the version to target from `abi3-py3*` features, or if there are multiple versions of Python present in `PYO3_CROSS_LIB_DIR`.
9596

0 commit comments

Comments
 (0)