Skip to content

Commit 9caeb18

Browse files
committed
chore(cmake): simplify Python ABI detection for Windows cross-compilation and add status messages
1 parent 1753fd8 commit 9caeb18

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ set(ARK_FBS_FLATBUFFERS_SOURCE_DIR "" CACHE PATH
88
set(CMAKE_CXX_STANDARD 14)
99
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1010

11-
# CMake >= 3.30 excludes free-threaded Python (gil_disabled) from FindPython by
12-
# default. scikit-build-core fails to pass this flag in Windows cross-compile
13-
# scenarios (e.g. AMD64 host building ARM64 cp314t wheels), so the library is
14-
# looked up as python314.lib instead of python314t.lib. Detect via SKBUILD_SOABI
15-
# (set by scikit-build-core before CMake runs) and opt in explicitly.
16-
if(DEFINED SKBUILD_SOABI)
17-
string(REGEX MATCH "[0-9]+t[-.]" _is_free_threaded "${SKBUILD_SOABI}")
18-
if(_is_free_threaded)
19-
set(Python_FIND_ABI "ANY" "ANY" "ANY" "ON")
20-
endif()
21-
unset(_is_free_threaded)
11+
# CMake excludes free-threaded Python from the default ABI search. On Windows
12+
# cross-compilation, that leads FindPython to look for pythonXY.lib instead of
13+
# pythonXYt.lib for cp3xyt targets. Allow either ABI and let FindPython choose
14+
# the matching interpreter/development pair.
15+
if(WIN32)
16+
set(Python_FIND_ABI "ANY" "ANY" "ANY" "ANY")
2217
endif()
2318

19+
message(STATUS "SKBUILD_SOABI=${SKBUILD_SOABI}")
20+
message(STATUS "Python_FIND_ABI=${Python_FIND_ABI}")
21+
2422
set(PYBIND11_FINDPYTHON ON)
2523
find_package(pybind11 CONFIG REQUIRED)
2624

0 commit comments

Comments
 (0)