From cf93f655758a1eceb0762a8a34074f567209fbf9 Mon Sep 17 00:00:00 2001 From: Lukas Burgholzer Date: Thu, 5 Sep 2024 15:32:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20make=20sure=20to=20define=20`Py?= =?UTF-8?q?=5FGIL=5FDISABLED`=20on=20Windows=20for=20Python=203.13t=20(#51?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description As pointed out in https://github.com/pypa/cibuildwheel/issues/1975#issuecomment-2296995654 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: - [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 --- CMakeLists.txt | 5 +++++ pyproject.toml | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b02d42746..4d384fa03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,11 @@ if(BUILD_MQT_QMAP_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 diff --git a/pyproject.toml b/pyproject.toml index b5d558f25..9f35fcb07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,6 +128,13 @@ sdist.exclude = [ BUILD_MQT_QMAP_TESTS = "OFF" BUILD_MQT_QMAP_BINDINGS = "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/qmap/_version.py"]