1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
--- a/wrappers/python/CMakeLists.txt
+++ b/wrappers/python/CMakeLists.txt
@@ -2,21 +2,32 @@
# Python extension builder
######################################################################################
-include(FindPythonInterp)
-include(FindPythonLibs)
+# yoh(Debian):
+# We are just building for a single version and all the magic there often leads to
+# breakages, so let's figure the paths for a single default Python out "manually"
+
+#include(FindPythonInterp)
+#include(FindPythonLibs)
find_program(CYTHON_EXECUTABLE cython)
+find_program(PYTHON_EXECUTABLE python)
# Figure out installation path
execute_process(COMMAND
- ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}')"
+ ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
+# Include headers
+execute_process(COMMAND
+ ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"
+ OUTPUT_VARIABLE PYTHON_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+
# Figure out numpy include path
execute_process(COMMAND
- ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()"
+ ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())"
OUTPUT_VARIABLE NUMPY_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+
# How to Cython the .pyx file
add_custom_command(OUTPUT freenect.c
COMMAND ${CYTHON_EXECUTABLE} -o freenect.c "${CMAKE_CURRENT_SOURCE_DIR}/freenect.pyx")
|