Skip to content

Commit

Permalink
First attempt at abi3.
Browse files Browse the repository at this point in the history
  • Loading branch information
hameerabbasi committed Jan 20, 2025
1 parent 4c77d12 commit 951903d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,28 @@ ignore_missing_imports = true
disallow_any_unimported = false

[tool.cibuildwheel]
build = "{cp3{10..13}-*,pp310-*}"
build = "{cp310-*,pp310-*}"
build-frontend = "build"
free-threaded-support = true
before-test = "pip install -r {project}/requirements/tests.txt"
test-command = "pytest --pyargs uarray"

[tool.cibuildwheel.linux]
repair-wheel-command = [
"auditwheel repair -w {dest_dir} {wheel}",
"pipx run abi3audit --strict --report {wheel}",
]
[tool.cibuildwheel.macos]
archs = ["universal2"]
repair-wheel-command = [
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
"pipx run abi3audit --strict --report {wheel}",
]
[tool.cibuildwheel.windows]
repair-wheel-command = [
"copy {wheel} {dest_dir}",
"pipx run abi3audit --strict --report {wheel}",
]

[[tool.cibuildwheel.overrides]]
select = "*-macosx_*"
Expand Down
20 changes: 18 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
from setuptools import setup
from setuptools import setup, Extension
from wheel.bdist_wheel import bdist_wheel

setup(cmake_source_dir="./src")

class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()

if python.startswith("cp"):
# on CPython, our wheels are abi3 and compatible back to 3.10
return "cp310", "abi3", plat

return python, abi, plat


setup(
cmake_source_dir="./src",
cmdclass={"bdist_wheel": bdist_wheel_abi3},
)
26 changes: 18 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ cmake_minimum_required(VERSION 3.15...3.30)

project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)

find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)

Python_add_library(_uarray MODULE
small_dynamic_array.h
vectorcall.h
vectorcall.cxx
_uarray_dispatch.cxx
WITH_SOABI)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})

if(NOT "${SKBUILD_SABI_VERSION}" STREQUAL "" AND Python_INTERPRETER_ID STREQUAL Python)
python_add_library(_uarray MODULE WITH_SOABI USE_SABI ${SKBUILD_SABI_VERSION}
small_dynamic_array.h
vectorcall.h
vectorcall.cxx
_uarray_dispatch.cxx
)
else()
python_add_library(_uarray MODULE WITH_SOABI
small_dynamic_array.h
vectorcall.h
vectorcall.cxx
_uarray_dispatch.cxx
)
endif()

set_property(TARGET _uarray PROPERTY CXX_STANDARD 17)
install(TARGETS _uarray LIBRARY DESTINATION uarray)

0 comments on commit 951903d

Please sign in to comment.