Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 38 additions & 36 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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 }}
Expand Down
22 changes: 20 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from wheel.bdist_wheel import bdist_wheel
from setuptools import setup
from codecs import open
import os
Expand All @@ -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',
Expand All @@ -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,
)