From e201c473fc6b14780ad86df0ba4c19658b02e13b Mon Sep 17 00:00:00 2001 From: Sergey Lisitsyn Date: Mon, 15 Apr 2024 14:32:13 +0100 Subject: [PATCH] Use Cython module --- CMakeLists.txt | 5 ++--- src/cmake/FindCython.cmake | 19 ------------------- 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 src/cmake/FindCython.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a3aec56..e43594a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,12 +85,11 @@ endmacro() option(BUILD_PYTHON "Whether to build Python interface" ON) if (BUILD_PYTHON) find_package(Python3 REQUIRED COMPONENTS Interpreter Development) - find_package(Cython REQUIRED) - set(_pyx_compiled_source "${CMAKE_CURRENT_BINARY_DIR}/tapkee.pyx.c") + set(_pyx_compiled_source "${CMAKE_CURRENT_BINARY_DIR}/pytapkee.c") set(_pyx_source "${CMAKE_CURRENT_SOURCE_DIR}/src/python/tapkee.pyx") add_custom_command( OUTPUT ${_pyx_compiled_source} - COMMAND ${CYTHON_EXECUTABLE} --cplus -o ${_pyx_compiled_source} ${_pyx_source} + COMMAND ${Python3_EXECUTABLE} -m cython --cplus -o ${_pyx_compiled_source} ${_pyx_source} DEPENDS ${_pyx_source} COMMENT "Generating Cython files ${_pyx_compiled_source}" ) diff --git a/src/cmake/FindCython.cmake b/src/cmake/FindCython.cmake deleted file mode 100644 index cff36ac..0000000 --- a/src/cmake/FindCython.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# Attempt to find Cython -find_program(CYTHON_EXECUTABLE - NAMES cython cython3 - DOC "Path to the Cython executable") - -# Determine if Cython is found -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Cython DEFAULT_MSG CYTHON_EXECUTABLE) - -if(CYTHON_FOUND) - set(CYTHON_VERSION "Unknown" CACHE STRING "Cython version") - execute_process(COMMAND ${CYTHON_EXECUTABLE} --version - OUTPUT_VARIABLE _cython_version_output - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "Cython version ([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" CYTHON_VERSION "${_cython_version_output}") -endif() - -mark_as_advanced(CYTHON_EXECUTABLE)