Skip to content

Commit edde6af

Browse files
committed
feat(core-cython-hello): Switch to using cython-cmake
1 parent eeefc9d commit edde6af

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

projects/core-cython-hello/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ find_package(
66
Python
77
COMPONENTS Interpreter Development.Module
88
REQUIRED)
9-
find_program(CYTHON "cython")
9+
10+
find_package(
11+
Cython
12+
REQUIRED)
1013

1114
add_subdirectory(hello)
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
add_custom_command(
2-
OUTPUT _hello.c
3-
DEPENDS _hello.pyx
4-
COMMAND "${CYTHON}"
5-
"${CMAKE_CURRENT_SOURCE_DIR}/_hello.pyx"
6-
--output-file "${CMAKE_CURRENT_BINARY_DIR}/_hello.c"
7-
VERBATIM
1+
Cython_compile_pyx(_hello.pyx
2+
OUTPUT_VAR _hello_source_file
83
)
94

105
Python_add_library(_hello
11-
MODULE "${CMAKE_CURRENT_BINARY_DIR}/_hello.c"
6+
MODULE ${_hello_source_file}
127
WITH_SOABI)
138

149
install(TARGETS _hello LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})

projects/core-cython-hello/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["scikit-build-core[pyproject]", "cython"]
2+
requires = ["scikit-build-core[pyproject]", "cython", "cython-cmake"]
33
build-backend = "scikit_build_core.build"
44

55
[project]

0 commit comments

Comments
 (0)