Skip to content

Commit

Permalink
Build with the Python limited API.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Oct 21, 2024
1 parent 14639d8 commit b363dae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ project(
find_package(Python COMPONENTS Interpreter Development REQUIRED)

Python_add_library(_nvjitlinklib MODULE pynvjitlink/_nvjitlinklib.cpp WITH_SOABI)
target_compile_definitions(
_nvjitlinklib
# Target Python 3.11, the earliest version to support the buffer protocol.
PRIVATE Py_LIMITED_API=0x030B0000
)

find_package(
# Require CUDA 12.2 Update 2 to avoid nvjitlink bugs
Expand Down
1 change: 1 addition & 0 deletions pynvjitlink/_nvjitlinklib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define PY_SSIZE_T_CLEAN
#include "nvJitLink.h"
#include <Python.h>
#include <cstdio>
#include <new>

static const char *nvJitLinkGetErrorEnum(nvJitLinkResult error) {
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ minimum-version = "build-system.requires"
ninja.make-fallback = true
build-dir = "build/{wheel_tag}"
wheel.packages = ["pynvjitlink"]
wheel.py-api = "cp311"

[build-system]
requires = [
Expand Down

0 comments on commit b363dae

Please sign in to comment.