Skip to content

Commit 82715d4

Browse files
authored
Merge pull request #429 from DiamonDinoia/cpython
Using pyproject.toml and Cmake to build wheels Missing testing wheels Close related issues.
2 parents cce4386 + d4631d7 commit 82715d4

16 files changed

+398
-993
lines changed

.github/workflows/cygwinccompiler.py

Lines changed: 0 additions & 408 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import json
2+
3+
matrix = {
4+
"include": []
5+
}
6+
7+
python_versions = ["3.8", "3.11"]
8+
9+
combinations = {
10+
"ubuntu-22.04": {
11+
"compiler": ["llvm", "gcc"],
12+
"arch_flags": ["-march=native", "-march=x86-64"]
13+
},
14+
"windows-2022": {
15+
"compiler": ["msvc", "llvm"],
16+
"arch_flags": ["/arch:AVX2", "/arch:SSE2"]
17+
},
18+
"macos-13": {
19+
"compiler": ["llvm", "gcc-14"],
20+
"arch_flags": ["-march=native", "-march=x86-64"]
21+
}
22+
}
23+
24+
for platform in combinations.keys():
25+
for python_version in python_versions:
26+
for compiler in combinations[platform]["compiler"]:
27+
for arch_flag in combinations[platform]["arch_flags"]:
28+
matrix["include"].append({
29+
"os": platform,
30+
"python-version": python_version,
31+
"compiler": compiler,
32+
"arch_flags": arch_flag
33+
})
34+
35+
json_str = json.dumps(matrix, ensure_ascii=False)
36+
print(json_str)
-54.9 KB
Binary file not shown.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build and test Python wheels
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels_unix:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, macos-13]
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Build wheels
17+
uses: pypa/[email protected]
18+
with:
19+
package-dir: 'python/finufft'
20+
env:
21+
CIBW_BEFORE_ALL_MACOS: brew install gcc@14 fftw
22+
CIBW_ARCHS_MACOS: "x86_64"
23+
# Need following versions of GCC for compatibility with fftw
24+
# installed by homebrew. Similarly, we set the macOS version
25+
# for compatibility with those libraries.
26+
CIBW_ENVIRONMENT_MACOS: >
27+
CC=gcc-14
28+
CXX=g++-14
29+
MACOSX_DEPLOYMENT_TARGET=13
30+
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: cibw-wheels-${{ matrix.os }}
34+
path: ./wheelhouse/*.whl
35+
36+
build_wheels_macos_arm64:
37+
name: Build wheels on macos-14
38+
runs-on: macos-14
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Build wheels
44+
uses: pypa/[email protected]
45+
with:
46+
package-dir: 'python/finufft'
47+
env:
48+
CIBW_ARCHS_MACOS: "arm64"
49+
# Make sure to install the ARM64-specific versions of FFTW and GCC.
50+
# Perhaps this is done automatically on the macos-14 image. We should
51+
# look into this further.
52+
CIBW_BEFORE_ALL_MACOS: |
53+
pkg=$(brew fetch --force --bottle-tag=arm64_ventura fftw | grep 'Downloaded to' | cut -d' ' -f3)
54+
brew install $pkg
55+
pkg=$(brew fetch --force --bottle-tag=arm64_ventura gcc | grep 'Downloaded to' | cut -d' ' -f3)
56+
brew install $pkg
57+
CIBW_ENVIRONMENT_MACOS: >
58+
CC=gcc-14
59+
CXX=g++-14
60+
MACOSX_DEPLOYMENT_TARGET=14
61+
62+
- uses: actions/upload-artifact@v4
63+
with:
64+
name: cibw-wheels-macos-arm64
65+
path: ./wheelhouse/*.whl
66+
67+
build_wheels_win:
68+
name: Build wheels on windows
69+
runs-on: windows-latest
70+
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- name: Install dependencies
75+
run: |
76+
# Here we install the mingw64 versions of gcc and FFTW that we will
77+
# use to compile the library. We also need pkg-config so that cmake
78+
# can easily find FFTW when configurating the build.
79+
c:\msys64\usr\bin\pacman.exe -Sy --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-fftw mingw-w64-x86_64-pkgconf
80+
# This particular install of mingw64 *is not* in the path by default
81+
# (another one at c:\mingw64 is, however), so we add it to the path.
82+
echo "c:\msys64\mingw64\bin;" >> $env:GITHUB_PATH
83+
84+
- name: Build wheels
85+
uses: pypa/[email protected]
86+
with:
87+
package-dir: 'python/finufft'
88+
env:
89+
# This is required to force cmake to avoid using MSVC (the default).
90+
# By setting the generator to Ninja, cmake will pick gcc (mingw64)
91+
# as the compiler.
92+
CIBW_CONFIG_SETTINGS: "cmake.args='-G Ninja'"
93+
94+
- uses: actions/upload-artifact@v4
95+
with:
96+
name: cibw-wheels-windows
97+
path: ./wheelhouse/*.whl

.github/workflows/python_build_win.ps1

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/python_cmake.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test python skbuild with CMake
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
prepare:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
matrix: ${{ steps.generate_matrix.outputs.matrix }}
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
- name: Generate matrix
14+
id: generate_matrix
15+
run: |
16+
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
17+
MATRIX=$(python3 ${{ github.workspace }}/.github/workflows/generate_matrix.py)
18+
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
19+
build:
20+
name: Build with Pip
21+
runs-on: ${{ matrix.os }}
22+
needs: prepare
23+
strategy:
24+
fail-fast: false
25+
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
- name: Setup Cpp
30+
uses: aminya/setup-cpp@v1
31+
with:
32+
compiler: ${{ matrix.compiler }}
33+
vcvarsall: ${{ contains(matrix.os, 'windows') }}
34+
cmake: false
35+
ninja: false
36+
vcpkg: false
37+
cppcheck: false
38+
clangtidy: false
39+
- name: Set min macOS version and install fftw
40+
if: runner.os == 'macOS'
41+
run: |
42+
brew install fftw
43+
- name: Install fftw
44+
if: runner.os == 'linux'
45+
run: |
46+
sudo apt update
47+
sudo apt install -y libfftw3-dev
48+
- name: Setup Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
- name: Install pytest
53+
run: |
54+
python3 -m pip install --upgrade pip
55+
python3 -m pip install pytest
56+
- name: Set compiler flags
57+
run: |
58+
echo CMAKE_ARGS="-DFINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }}" >> $GITHUB_ENV
59+
shell: bash
60+
- name: Build
61+
run: python3 -m pip install ${{ github.workspace }}/python/finufft --verbose
62+
- name: Test
63+
run: python3 -m pytest ${{ github.workspace }}/python/finufft/test

.github/workflows/python_test_win.ps1

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)