From ebc52c4aeabb07d48f33a3df9f6b13ec6392e903 Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 14 Feb 2021 14:34:55 +0800 Subject: [PATCH] Don't require PYO3_CROSS_LIB_DIR when compiling for x86_64 from macOS arm64 and reverse --- CHANGELOG.md | 1 + build.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d2c360d..f09838f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Remove FFI definition `PyCFunction_ClearFreeList` for Python 3.9 and later. [#1425](https://github.com/PyO3/pyo3/pull/1425) +- `PYO3_CROSS_LIB_DIR` enviroment variable no long required when compiling for x86-64 Python from macOS arm64 and reverse. [#1428](https://github.com/PyO3/pyo3/pull/1428) ## [0.13.2] - 2021-02-12 ### Packaging diff --git a/build.rs b/build.rs index aa3e474f..76df0444 100644 --- a/build.rs +++ b/build.rs @@ -142,6 +142,15 @@ fn cross_compiling() -> Result> { return Ok(None); } + if target == "x86_64-apple-darwin" && host == "aarch64-apple-darwin" { + // Not cross-compiling to compile for x86-64 Python from macOS arm64 + return Ok(None); + } + if target == "aarch64-apple-darwin" && host == "x86_64-apple-darwin" { + // Not cross-compiling to compile for arm64 Python from macOS x86_64 + return Ok(None); + } + if host.starts_with(&format!( "{}-{}-{}", env::var("CARGO_CFG_TARGET_ARCH")?,