Skip to content

Commit

Permalink
Attempt fixing detection of PyInterpreterState_GetID
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Oct 12, 2024
1 parent 8f4f6ab commit 2146a98
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/scripts/cmake/CythonExtension.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ get_property(PYTHON_EXTENSIONS_SOURCE_DIR GLOBAL PROPERTY PYTHON_EXTENSIONS_SOUR
# --- Detect PyInterpreterState_GetID ------------------------------------------

include(CheckCSourceCompiles)
include(CheckSymbolExists)

set(SAFE_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
set(CMAKE_REQUIRED_INCLUDES "${Python_INCLUDE_DIRS}")
set(PYINTERPRETER_STATE_SOURCE.github/workflows/requirements.txt
"
#include <stdint.h>
#include <stdlib.h>
#include <Python.h>
int main(int argc, char *argv[]) {
PyInterpreterState_GetID(NULL);
return 0;
}
")
check_c_source_compiles("${PYINTERPRETER_STATE_SOURCE}" HAVE_PYINTERPRETERSTATE_GETID)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Python_INCLUDE_DIRS})
# set(PYINTERPRETER_STATE_SOURCE
# "
# #include <stdint.h>
# #include <stdlib.h>
# #include <Python.h>

# int main(int argc, char *argv[]) {
# PyInterpreterState_GetID(NULL);
# return 0;
# }
# ")
# check_c_source_compiles("${PYINTERPRETER_STATE_SOURCE}" HAVE_PYINTERPRETERSTATE_GETID)
check_symbol_exists(PyInterpreterState_GetID "stdint.h;stdlib.h;Python.h" HAVE_PYINTERPRETERSTATE_GETID)
set(CMAKE_REQUIRED_INCLUDES "${SAFE_CMAKE_REQUIRED_INCLUDES}")

# --- Detect implementation ----------------------------------------------------
Expand Down

0 comments on commit 2146a98

Please sign in to comment.