Skip to content

ci: enable Win ARM #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
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
14 changes: 13 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
types:
- published

env:
FORCE_COLOR: 3

jobs:
build_sdist:
name: Build SDist
Expand All @@ -36,7 +39,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [windows-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -45,11 +48,20 @@ jobs:

- uses: pypa/[email protected]
env:
CIBW_BUILD: cp311-* cp312-*

# Cross-compile on macOS
CIBW_ARCHS_MACOS: x86_64 arm64

# Cross-compile on Win
CIBW_ARCHS_WINDOWS: ARM64

# Temporary: use pre-release Python 3.12 for stable ABI builds
CIBW_PRERELEASE_PYTHONS: True

# Debugging
SKBUILD_CMAKE_VERBOSE: 1
SKBUILD_LOGGING_LEVEL: DEBUG

- name: Verify clean directory
run: git diff --exit-code
Expand Down
34 changes: 32 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,44 @@ if (NOT SKBUILD)
after editing C++ files.")
endif()

include(CMakePrintHelpers)

message(STATUS "PYTHONPATH: $ENV{PYTHONPATH}")
message(STATUS "_PYTHON_SYSCONFIGDATA_NAME: $ENV{_PYTHON_SYSCONFIGDATA_NAME}")

execute_process(
COMMAND "${Python_EXECUTABLE}" "-c"
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
OUTPUT_VARIABLE EXT_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
cmake_print_variables(EXT_SUFFIX)

# Try to import all Python components potentially needed by nanobind
find_package(Python 3.8
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)
REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})

# Import nanobind through CMake's find_package mechanism
find_package(nanobind CONFIG REQUIRED)

execute_process(
COMMAND "${Python_EXECUTABLE}" "-c"
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
OUTPUT_VARIABLE EXT_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
cmake_print_variables(EXT_SUFFIX)

execute_process(
COMMAND "${Python_EXECUTABLE}" "-c"
"import sysconfig; print(sysconfig.get_config_var('SOABI'))"
OUTPUT_VARIABLE SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE)
cmake_print_variables(SOABI)

message(STATUS "PYTHONPATH: $ENV{PYTHONPATH}")
message(STATUS "_PYTHON_SYSCONFIGDATA_NAME: $ENV{_PYTHON_SYSCONFIGDATA_NAME}")

cmake_print_variables(Python_SOABI SKBUILD_SOABI NB_SUFFIX)

# We are now ready to compile the actual extension module
nanobind_add_module(
# Name of the extension
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[build-system]
requires = ["scikit-build-core >=0.4.3", "nanobind >=1.3.2"]
requires = [
"scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core@henryiii/fix/backport327",
"nanobind @ git+https://github.com/wjakob/nanobind@master"]
build-backend = "scikit_build_core.build"

[project]
Expand Down