Skip to content

Commit

Permalink
[FindPython] Work around PyPy bug (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbachmann authored Sep 22, 2022
1 parent d330d2c commit a30c0e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ project(jarowinkler LANGUAGES C CXX)
if(CMAKE_VERSION VERSION_LESS 3.18)
find_package(Python COMPONENTS Interpreter Development REQUIRED)
else()
set(Python_ARTIFACTS_INTERACTIVE TRUE)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
endif()

if("${Python_INTERPRETER_ID}" STREQUAL "PyPy")
message(STATUS "PyPy SOABI: ${Python_SOABI}")
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX').split('.')[1])"
OUTPUT_VARIABLE Python_SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
message(STATUS "Corrected SOABI: ${Python_SOABI}")
endif()

include(FetchContent)

set(JW_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
Expand Down
2 changes: 1 addition & 1 deletion src/jarowinkler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function(create_cython_target _name)
endfunction(create_cython_target)

create_cython_target(_initialize_cpp)
Python_add_library(_initialize_cpp MODULE ${_initialize_cpp})
Python_add_library(_initialize_cpp MODULE WITH_SOABI ${_initialize_cpp})
target_compile_features(_initialize_cpp PUBLIC cxx_std_14)
target_include_directories(_initialize_cpp PRIVATE ${RF_CAPI_PATH} ${JW_BASE_DIR}/jarowinkler)
target_link_libraries(_initialize_cpp PRIVATE jaro_winkler::jaro_winkler)
Expand Down

0 comments on commit a30c0e7

Please sign in to comment.