From 64bac196b917ee40409c2c7b7e99b050e6cd086a Mon Sep 17 00:00:00 2001 From: Delcior Date: Tue, 7 Jul 2026 22:32:08 +0200 Subject: [PATCH] add arm64 wheels --- .github/workflows/cmake.yml | 74 +++++++++++++++++++------------------ python/setup.py | 22 ++++++++++- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7ba8f27..30571c8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,11 +11,19 @@ env: BUILD_TYPE: Release jobs: - build_ubuntu_latest: - runs-on: ubuntu-latest + build_ubuntu: + strategy: + matrix: + include: + - runner: ubuntu-22.04 + artifact_name: wheel_ubuntu + - runner: ubuntu-22.04-arm + artifact_name: wheel_ubuntu_arm + + runs-on: ${{ matrix.runner }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 with: submodules: true @@ -24,7 +32,7 @@ jobs: - name: Configure CMake working-directory: ./build_python - run: cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ../python + run: cmake -DCMAKE_CXX_FLAGS="-include cstdio" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ../python - name: Make working-directory: ./build_python @@ -33,18 +41,31 @@ jobs: - name: Make Install working-directory: ./build_python run: make install - - - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 + + - name: Set up Python + uses: actions/setup-python@v6 with: - name: binary_ubuntu - path: ./install + python-version: 3.8 + - name: Install dependencies + run: pip install setuptools wheel twine + + - name: run setup.py + working-directory: ./install/test_python + run: python setup.py bdist_wheel + + - name: Twine upload + working-directory: ./install/test_python/dist + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: twine upload *.whl + build_windows: - runs-on: windows-latest + runs-on: windows-2022 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 with: submodules: true @@ -64,40 +85,21 @@ jobs: - name: Make Install working-directory: ./build_python run: nmake install - - - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 - with: - name: binary_windows - path: ./install - - build_wheel: - needs: [build_ubuntu_latest, build_windows] - runs-on: ubuntu-latest - steps: - - name: Download binary_ubuntu - uses: actions/download-artifact@v2 + - name: Set up Python + uses: actions/setup-python@v6 with: - name: binary_ubuntu - - - name: Download binary_windows - uses: actions/download-artifact@v2 - with: - name: binary_windows - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + python-version: 3.8 - name: Install dependencies run: pip install setuptools wheel twine - name: run setup.py - working-directory: ./test_python + working-directory: ./install/test_python run: python setup.py bdist_wheel - + - name: Twine upload - working-directory: ./test_python/dist + working-directory: ./install/test_python/dist env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} diff --git a/python/setup.py b/python/setup.py index e7e0aad..a918277 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,3 +1,4 @@ +from wheel.bdist_wheel import bdist_wheel from setuptools import setup from codecs import open import os @@ -7,6 +8,23 @@ with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() +def get_package_data(): + if os.name == 'nt': + return ['PyThrustRTC.dll'] + elif os.name == "posix": + return ['libPyThrustRTC.so'] + +class bdist_wheel_platform_tag(bdist_wheel): + def finalize_options(self): + bdist_wheel.finalize_options(self) + self.root_is_pure = False + + def get_tag(self): + _, _, platform = bdist_wheel.get_tag(self) + return 'py3', 'none', platform + +cmdclass = {'bdist_wheel': bdist_wheel_platform_tag} + setup( name = 'ThrustRTC', version = '0.3.20', @@ -19,7 +37,7 @@ author_email='hyangfeih@gmail.com', keywords='GPU CUDA Thrust', packages=['ThrustRTC'], - package_data = { 'ThrustRTC': ['*.dll', '*.so']}, + package_data = { 'ThrustRTC': get_package_data()}, install_requires = ['cffi','numpy'], + cmdclass=cmdclass, ) -