From 15ee51e0c552fafd62cae97cc5106bf59c89a8f1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Sat, 23 Sep 2023 10:52:37 -0400 Subject: [PATCH] Build wheels for windows arm64 Signed-off-by: Jean-Christophe Morin --- .github/workflows/wheel.yaml | 32 ++++++++++++++++++++++++++------ setup.py | 14 +++++++++++--- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 174ee51cb0..5d7310eebd 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -11,13 +11,23 @@ jobs: launchers: name: launcher runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - msvc-arch: amd64_arm64 + cmake-arch: ARM64 + artifact: arm64 + - msvc-arch: amd64 + cmake-arch: x64 + artifact: amd64 steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 with: - arch: amd64 + arch: ${{ matrix.msvc-arch }} - name: Build shell: bash @@ -34,11 +44,14 @@ jobs: mkdir build cd build - cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release - VERBOSE=1 cmake --build . + cmake .. -A "${GENERATOR_PLATFORM}" -DCMAKE_CONFIGURATION_TYPES=Release + VERBOSE=1 cmake --build . --config Release - mv simple_launcher_cli.exe t64.exe - mv simple_launcher_gui.exe w64.exe + mv Release/simple_launcher_cli.exe "t-${REZ_ARTIFACT_NAME}.exe" + mv Release/simple_launcher_gui.exe "w-${REZ_ARTIFACT_NAME}.exe" + env: + GENERATOR_PLATFORM: ${{ matrix.cmake-arch }} + REZ_ARTIFACT_NAME: ${{ matrix.artifact }} - uses: actions/upload-artifact@v3 with: @@ -54,7 +67,12 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + - os: windows-latest + arch: win_amd64 + - os: windows-latest + arch: win_arm64 steps: - uses: actions/checkout@v4 @@ -75,6 +93,8 @@ jobs: set -ex python -m pip install build python -m build -w . --outdir ./dist + env: + PYTHON_PLAT_NAME: ${{ matrix.arch }} - uses: actions/upload-artifact@v3 with: diff --git a/setup.py b/setup.py index 6f2ece0fb8..fb42d377f6 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,13 @@ def find_files(pattern, path=None, root="rez"): """ +def _get_platform(): + if os.environ.get("PYTHON_PLAT_NAME"): + return os.environ.get("PYTHON_PLAT_NAME") + + return get_platform(None) + + class rez_build_scripts(build_scripts): def finalize_options(self): build_scripts.finalize_options(self) @@ -107,9 +114,10 @@ def run(self): scripts.append(path) if platform.system() == "Windows": - launcher = "t64.exe" + arch = _get_platform().split("_", 1)[-1] + launcher = f"t-{arch}.exe" if spec["type"] == "window": - launcher = "w64.exe" + launcher = f"w-{arch}.exe" self.copy_file( os.path.join("launcher", launcher), @@ -131,7 +139,7 @@ def finalize_options(self): self.universal = True # Support python 2 and 3 if platform.system() == "Windows": self.plat_name_supplied = True - self.plat_name = get_platform("") + self.plat_name = _get_platform() bdist_wheel.finalize_options(self)