@@ -31,17 +31,30 @@ execute_process(COMMAND
31
31
-c "import numpy; print(numpy.get_include())"
32
32
OUTPUT_VARIABLE Python${Python_BUILD_VERSION} _NumPy_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
33
33
34
+ # cython 3.0 has breaking changes, like certain functions must be marked noexcept
35
+ # but noexcept is not defined in old cython < 0.29.31 shipped in ubuntu 20.04
36
+ # todo: eventually drop support for cython 0.x.x
37
+ execute_process (COMMAND
38
+ ${CYTHON_EXECUTABLE} --version
39
+ ERROR_VARIABLE CYTHON_VERSION_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE)
40
+ string (REGEX MATCH "[0-9]+\\ .[0-9]+\\ .[0-9]+" CYTHON_VERSION "${CYTHON_VERSION_OUTPUT} " )
41
+ string (REGEX MATCHALL "[0-9]+" CYTHON_VERSION_COMPONENTS "${CYTHON_VERSION} " )
42
+ list (GET CYTHON_VERSION_COMPONENTS 0 CYTHON_VERSION_MAJOR)
43
+ list (GET CYTHON_VERSION_COMPONENTS 1 CYTHON_VERSION_MINOR)
44
+ list (GET CYTHON_VERSION_COMPONENTS 2 CYTHON_VERSION_PATCH)
45
+ if (${CYTHON_VERSION_MAJOR} LESS_EQUAL 0)
46
+ set (FREENECT_PYX "freenect.cython0.pyx" )
47
+ else ()
48
+ set (FREENECT_PYX "freenect.pyx" )
49
+ endif ()
50
+
34
51
# How to Cython the .pyx file
35
52
add_custom_command (OUTPUT freenect${Python_BUILD_VERSION} .c
36
53
COMMAND
37
54
${CYTHON_EXECUTABLE}
38
55
-${Python_BUILD_VERSION}
39
56
-o freenect${Python_BUILD_VERSION} .c
40
- # cython 3.0 needs certain functions to be marked noexcept
41
- # but noexcept is not defined in old cython shipped in ubuntu 20.04
42
- # todo: eventually require cython >= 0.29.31 and add proper noexcept without this workaround
43
- -X legacy_implicit_noexcept=True
44
- "${CMAKE_CURRENT_SOURCE_DIR} /freenect.pyx" )
57
+ "${CMAKE_CURRENT_SOURCE_DIR} /${FREENECT_PYX} " )
45
58
list (APPEND ADDITIONAL_MAKE_CLEAN_FILES freenect${Python_BUILD_VERSION} .c)
46
59
47
60
# Compile the extension
0 commit comments