Files
CoolProp/wrappers/Python/cmake/FindCython.cmake
Ian Bell 6e6363f7f8 Modernize Python build system to use scikit-build-core
This commit replaces the old setuptools-based build system with a modern
scikit-build-core + CMake build system for the Python bindings.

Key changes:
- Replace setup.py with pyproject.toml using scikit-build-core backend
- Create new CMakeLists.txt for Cython module compilation
- Add FindCython.cmake helper module
- Update README from .rst to .md format
- Enable incremental builds with proper CMake dependency tracking
- Support Python 3.8-3.14 with proper Cython directives

Benefits:
- Incremental builds work correctly (only rebuild changed files)
- Modern PEP 517/518 compliant build system
- Build artifacts cached in build/{wheel_tag} directories
- Better integration with pip and modern Python tooling
- No more need for custom _py_backend build hooks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 09:26:37 -04:00

43 lines
1.2 KiB
CMake

# Find Cython
# This module finds the Cython compiler and creates an imported target
find_package(Python COMPONENTS Interpreter REQUIRED)
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import cython; print(cython.__version__)"
OUTPUT_VARIABLE CYTHON_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
RESULT_VARIABLE CYTHON_NOT_FOUND
)
if(CYTHON_NOT_FOUND)
set(Cython_FOUND FALSE)
else()
set(Cython_FOUND TRUE)
# Get path to cython executable
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import sys; import cython; print(sys.executable)"
OUTPUT_VARIABLE CYTHON_EXECUTABLE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT TARGET Cython::Cython)
add_executable(Cython::Cython IMPORTED)
set_target_properties(Cython::Cython PROPERTIES
IMPORTED_LOCATION "${Python_EXECUTABLE}"
)
# Set command to run cython via python -m
set(CYTHON_COMMAND "${Python_EXECUTABLE}" -m cython)
endif()
message(STATUS "Found Cython: ${CYTHON_VERSION}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cython
REQUIRED_VARS Cython_FOUND
VERSION_VAR CYTHON_VERSION
)