Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cross compilation for macOS ARM builds in
cibuildwheel
(google#…
…1334) This commit contains a fix for macOS ARM64 wheel buils in Google Benchmark's wheel building CI. Previously, while `cibuildwheel` itself properly identified the need for cross-compilations and produced valid ARM platform wheels, the included shared library containing the Python bindings built by `bazel` was built for x86, resulting in immediate errors upon import. To fix this, logic was added to the setup.py file that adds the "--cpu=darwin_arm64" and "--macos_cpus=arm64" switches to the `bazel build` command if 1) The current system platform is macOS Darwin running on the x86_64 architecture, and 2) The ARCHFLAGS environment variable, set by wheel build systems like conda and cibuildwheel, contains the tag "arm64". This way, bazel correctly sets the target CPU to ARM64, and produces functional wheels for the macOS ARM line of CPUs.
- Loading branch information