Skip to content

Commit

Permalink
Merge pull request #3 from Natooz/fixing-windows-build
Browse files Browse the repository at this point in the history
Fixing windows build
  • Loading branch information
Natooz authored Sep 18, 2024
2 parents 840d48e + 3b93ff2 commit 315100e
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 178 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Test build wheel

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
matrix:
# From wheel.yml of numpy (https://github.com/numpy/numpy/blob/main/.github/workflows/wheels.yml):
# GitHub Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
# https://cibuildwheel.pypa.io/en/stable/options/#build-skip
# https://cibuildwheel.pypa.io/en/stable/options/#archs
buildplat: # [os, dist, arch]
- [ubuntu-latest, manylinux_x86_64, x86_64]
- [ubuntu-latest, musllinux_x86_64, x86_64]
- [ubuntu-latest, manylinux_aarch64, aarch64]
- [ubuntu-latest, musllinux_aarch64, aarch64]
- [macos-13, macosx_x86_64, x86_64]
- [macos-14, macosx_arm64, arm64]
- [windows-2022, win32, x86]
- [windows-latest, win_amd64, AMD64]
# - [windows-latest, win_arm64, ARM64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312", "pp39", "pp310"]
# PyPy is not supported for musllinux, win32 and windows arm64
# CPython 3.8 is not supported on windows arm64
exclude:
- buildplat: [ windows-2022, win32, x86 ]
python: "pp39"
- buildplat: [ windows-latest, win_arm64, ARM64 ]
python: "pp39"
- buildplat: [ ubuntu-latest, musllinux_x86_64, x86_64 ]
python: "pp39"
- buildplat: [ ubuntu-latest, musllinux_aarch64, aarch64 ]
python: "pp39"
- buildplat: [ windows-2022, win32, x86 ]
python: "pp310"
- buildplat: [ windows-latest, win_arm64, ARM64 ]
python: "pp310"
- buildplat: [ ubuntu-latest, musllinux_x86_64, x86_64 ]
python: "pp310"
- buildplat: [ ubuntu-latest, musllinux_aarch64, aarch64 ]
python: "pp310"
- buildplat: [ windows-latest, win_arm64, ARM64 ]
python: "cp38"

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

# Required for linux arm64
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation
- name: Set up QEMU
if: ${{ contains(matrix.buildplat[1], 'linux_aarch64') }}
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Setup MSVC (32-bit)
if: ${{ matrix.buildplat[1] == 'win32' }}
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: ${{ matrix.buildplat[2] }}

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_MACOS: >
CFLAGS='-s'
CXXFLAGS='-s'
MACOSX_DEPLOYMENT_TARGET='10.15'
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build sdist
run: pipx run build --sdist
95 changes: 40 additions & 55 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,51 @@ jobs:
strategy:
matrix:
# From wheel.yml of numpy (https://github.com/numpy/numpy/blob/main/.github/workflows/wheels.yml):
# Github Actions doesn't support pairing matrix values together, let's improvise
# GitHub Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
- [ubuntu-22.04, manylinux_x86_64]
- [ubuntu-22.04, musllinux_x86_64]
- [ubuntu-22.04, manylinux_aarch64]
- [ubuntu-22.04, musllinux_aarch64]
- [macos-12, macosx_x86_64]
- [macos-12, macosx_arm64]
- [windows-2022, win_amd64]
- [windows-2022, win32]
python: ["cp38", "cp39", "cp310", "cp311", "cp312", "pp39"]
# https://cibuildwheel.pypa.io/en/stable/options/#build-skip
# https://cibuildwheel.pypa.io/en/stable/options/#archs
buildplat: # [os, dist, arch]
- [ ubuntu-latest, manylinux_x86_64, x86_64 ]
- [ ubuntu-latest, musllinux_x86_64, x86_64 ]
- [ ubuntu-latest, manylinux_aarch64, aarch64 ]
- [ ubuntu-latest, musllinux_aarch64, aarch64 ]
- [ macos-13, macosx_x86_64, x86_64 ]
- [ macos-14, macosx_arm64, arm64 ]
- [ windows-2022, win32, x86 ]
- [ windows-latest, win_amd64, AMD64 ]
# - [windows-latest, win_arm64, ARM64]
python: [ "cp38", "cp39", "cp310", "cp311", "cp312", "pp39", "pp310" ]
# PyPy is not supported for musllinux, win32 and windows arm64
# CPython 3.8 is not supported on windows arm64
exclude:
- buildplat: [windows-2022, win32]
- buildplat: [ windows-2022, win32, x86 ]
python: "pp39"
- buildplat: [ ubuntu-22.04, musllinux_x86_64 ]
- buildplat: [ windows-latest, win_arm64, ARM64 ]
python: "pp39"
- buildplat: [ ubuntu-22.04, musllinux_aarch64 ]
- buildplat: [ ubuntu-latest, musllinux_x86_64, x86_64 ]
python: "pp39"
- buildplat: [macos-12, macosx_arm64]
- buildplat: [ ubuntu-latest, musllinux_aarch64, aarch64 ]
python: "pp39"
- buildplat: [ windows-2022, win32, x86 ]
python: "pp310"
- buildplat: [ windows-latest, win_arm64, ARM64 ]
python: "pp310"
- buildplat: [ ubuntu-latest, musllinux_x86_64, x86_64 ]
python: "pp310"
- buildplat: [ ubuntu-latest, musllinux_aarch64, aarch64 ]
python: "pp310"
- buildplat: [ windows-latest, win_arm64, ARM64 ]
python: "cp38"

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

# Required for linux arm64
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation
- name: Set up QEMU
if: ${{ contains(matrix.buildplat[1], 'linux_aarch64') }}
uses: docker/setup-qemu-action@v3
Expand All @@ -54,54 +71,22 @@ jobs:
if: ${{ matrix.buildplat[1] == 'win32' }}
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: 'x86'

- name: Build wheels for manylinux x86_64
if: ${{ matrix.buildplat[1] == 'manylinux_x86_64' }}
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64
CIBW_ARCHS: 'all'

- name: Build wheels for manylinux aarch64
if: ${{ matrix.buildplat[1] == 'manylinux_aarch64' }}
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64
CIBW_ARCHS: 'all'

- name: Build wheels for musllinux x86_64
if: ${{ matrix.buildplat[1] == 'musllinux_x86_64' }}
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/musllinux_1_2_x86_64
CIBW_ARCHS: 'all'

- name: Build wheels for musllinux aarch64
if: ${{ matrix.buildplat[1] == 'musllinux_aarch64' }}
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_MUSLLINUX_AARCH64_IMAGE: quay.io/pypa/musllinux_1_2_aarch64
CIBW_ARCHS: 'all'
architecture: ${{ matrix.buildplat[2] }}

- name: Build wheels
if: ${{ !contains(matrix.buildplat[1], 'linux') }}
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
uses: pypa/[email protected]
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_ARCHS: 'all'
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_MACOS: >
CFLAGS='-s'
CXXFLAGS='-s'
MACOSX_DEPLOYMENT_TARGET='10.15'
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl

build_sdist:
Expand Down
120 changes: 0 additions & 120 deletions .github/workflows/test_wheel.yml

This file was deleted.

1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ find_package(nanobind CONFIG REQUIRED)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)

# optimized release build
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand Down
15 changes: 15 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
Loading

0 comments on commit 315100e

Please sign in to comment.