Skip to content

Commit

Permalink
🩹 make sure to define Py_GIL_DISABLED on Windows for Python 3.13t (#…
Browse files Browse the repository at this point in the history
…452)

## Description

As pointed out in
pypa/cibuildwheel#1975 (comment)
free-threading (Python 3.13t) builds on Windows need to have
`Py_GIL_DISABLED` set in order to properly work.
This PR ensures that the corresponding setting is always set.

## Checklist:

<!---
This checklist serves as a reminder of a couple of things that ensure
your pull request will be merged swiftly.
-->

- [x] The pull request only contains commits that are related to it.
- [x] I have added appropriate tests and documentation.
- [x] I have made sure that all CI jobs on GitHub pass.
- [x] The pull request introduces no new warnings and follows the
project's style guidelines.

Signed-off-by: burgholzer <[email protected]>
  • Loading branch information
burgholzer authored Sep 5, 2024
1 parent cbf6bd5 commit fd93799
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if(BUILD_MQT_QCEC_BINDINGS)
ON
CACHE BOOL "Prevent multiple searches for Python and instead cache the results.")

if(DISABLE_GIL)
message(STATUS "Disabling Python GIL")
add_compile_definitions(Py_GIL_DISABLED)
endif()

# top-level call to find Python
find_package(
Python 3.8 REQUIRED
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ BUILD_MQT_QCEC_TESTS = "OFF"
BUILD_MQT_QCEC_BINDINGS = "ON"
ENABLE_IPO = "ON"

[[tool.scikit-build.overrides]]
if.python-version = ">=3.13"
if.abi-flags = "t"
if.platform-system = "win32"
inherit.cmake.define = "append"
cmake.define.DISABLE_GIL = "1"


[tool.check-sdist]
sdist-only = ["src/mqt/qcec/_version.py"]
Expand Down

0 comments on commit fd93799

Please sign in to comment.