From 68916b557e5f47d25b37b07cc56908c76dd969d0 Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 14 Feb 2021 13:15:14 +0800 Subject: [PATCH] Support building x86-64 wheel on arm64 macOS machine --- CHANGELOG.md | 1 + setuptools_rust/build.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6368b553..0345aaf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Append to, rather than replace, existing RUSTFLAGS when building. [#103](https://github.com/PyO3/setuptools-rust/pull/103) - Set executable bit on shared library. [#110](https://github.com/PyO3/setuptools-rust/pull/110) - Don't require optional wheel dependency. [#111](https://github.com/PyO3/setuptools-rust/pull/111) +- Support building x86-64 wheel on arm64 macOS machine. [#114](https://github.com/PyO3/setuptools-rust/pull/114) ## 0.11.6 (2020-12-13) diff --git a/setuptools_rust/build.py b/setuptools_rust/build.py index a2f7ef25..1bde9952 100644 --- a/setuptools_rust/build.py +++ b/setuptools_rust/build.py @@ -2,6 +2,7 @@ import glob import json import os +import platform import shutil import sys import subprocess @@ -103,6 +104,9 @@ def build_extension(self, ext): target_triple = "i686-pc-windows-msvc" elif self.plat_name == "win-amd64": target_triple = "x86_64-pc-windows-msvc" + elif self.plat_name.startswith("macosx-") and platform.machine() == "x86_64": + # x86_64 or arm64 macOS targeting x86_64 + target_triple = "x86_64-apple-darwin" if target_triple is not None: target_args = ["--target", target_triple]