Skip to content

Commit

Permalink
Fix detection of PyInterpreterState_GetID in CMake files
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Oct 12, 2024
1 parent 2146a98 commit 383c496
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pyhmmer/_getid.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cdef extern from *:
"""
#ifndef HAS_PYINTERPRETERSTATE_GETID
#ifndef HAVE_PYINTERPRETERSTATE_GETID
int64_t PyInterpreterState_GetID(PyInterpreterState *interp) {
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/cmake/CythonExtension.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ set(CYTHON_DIRECTIVES
-E SYS_BYTEORDER=$<IF:$<STREQUAL:${CMAKE_C_BYTE_ORDER},BIG_ENDIAN>,big,little>
-E PYPY=$<IF:$<STREQUAL:${Python_INTERPRETER_ID},PyPy>,True,False>
-E PROJECT_VERSION=${CMAKE_PROJECT_VERSION}
-E HAVE_PYINTERPRETERSTATE_GETID=$<IF:$<BOOL:${HAVE_PYINTERPRETERSTATE_GETID}>,True,False>
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down Expand Up @@ -118,6 +117,9 @@ macro(cython_extension _name)
set_target_properties(${_target} PROPERTIES OUTPUT_NAME ${_name} )
target_include_directories(${_target} AFTER PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${_target} PUBLIC ${CYTHON_EXTENSION_LINKS})
if(HAVE_PYINTERPRETERSTATE_GETID)
target_compile_definitions(${_target} -DHAVE_PYINTERPRETERSTATE_GETID)
endif()

if(CMAKE_BUILD_TYPE STREQUAL Debug)
if(NOT Python_INTERPRETER_ID STREQUAL PyPy)
Expand Down

0 comments on commit 383c496

Please sign in to comment.