From 0332bc5d8780115738334d171d6a316e2bcd221c Mon Sep 17 00:00:00 2001 From: Lenny Truong Date: Fri, 22 Sep 2023 13:36:07 -0700 Subject: [PATCH] [CI] Add macosx_arm64 python wheel --- .github/workflows/uploadWheels.yml | 9 +++++++++ lib/Bindings/Python/setup.py | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/uploadWheels.yml b/.github/workflows/uploadWheels.yml index 8ad5c09cc81c..8d1303cb0b3a 100644 --- a/.github/workflows/uploadWheels.yml +++ b/.github/workflows/uploadWheels.yml @@ -32,6 +32,14 @@ jobs: cibw_build: cp310-macosx_x86_64 - os: macos-latest cibw_build: cp311-macosx_x86_64 + - os: macos-latest + cibw_build: cp38-macosx_arm64 + - os: macos-latest + cibw_build: cp39-macosx_arm64 + - os: macos-latest + cibw_build: cp310-macosx_arm64 + - os: macos-latest + cibw_build: cp311-macosx_arm64 steps: - name: Get CIRCT @@ -57,6 +65,7 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_BUILD_FRONTEND: build SETUPTOOLS_SCM_DEBUG: True + CIBW_TEST_SKIP: "*-macosx_arm64" - name: Upload (stage) wheels as artifacts uses: actions/upload-artifact@v3 diff --git a/lib/Bindings/Python/setup.py b/lib/Bindings/Python/setup.py index fe0136c7aa54..c094a572de83 100644 --- a/lib/Bindings/Python/setup.py +++ b/lib/Bindings/Python/setup.py @@ -78,6 +78,10 @@ def run(self): "-DCIRCT_RELEASE_TAG_ENABLED=ON", "-DCIRCT_RELEASE_TAG=firtool", ] + if 'macosx_arm64' in os.getenv('CIBW_BUILD', ''): + archs = re.findall(r"-arch (\S+)", os.getenv("ARCHFLAGS", "")) + if archs: + cmake_args.append(f"-DCMAKE_OSX_ARCHITECTURES={archs}") # HACK: CMake fails to auto-detect static linked Python installations, which # happens to be what exists on manylinux. We detect this and give it a dummy