Skip to content

Commit

Permalink
build: restore PYO3_CROSS variable
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Apr 11, 2021
1 parent 6abd255 commit 60a0db6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ fn cross_compiling() -> Result<Option<CrossCompileConfig>> {
let target_vendor = cargo_env_var("CARGO_CFG_TARGET_VENDOR");
let target_os = cargo_env_var("CARGO_CFG_TARGET_OS");

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

Expand Down
1 change: 1 addition & 0 deletions guide/src/building_and_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ See [github.com/japaric/rust-cross](https://github.com/japaric/rust-cross) for a

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

* `PYO3_CROSS`: If present this variable forces PyO3 to configure as a cross-compilation.
* `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.
* `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`.

Expand Down

0 comments on commit 60a0db6

Please sign in to comment.