forked from OpenKinect/libfreenect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce wrappers/python into cmake build framework
Signed-off-by: Yaroslav Halchenko <[email protected]>
- Loading branch information
1 parent
08b212f
commit d94c8c0
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
###################################################################################### | ||
# Python extension builder | ||
###################################################################################### | ||
|
||
include(FindPythonInterp) | ||
include(FindPythonLibs) | ||
|
||
find_program(CYTHON_EXECUTABLE cython) | ||
|
||
# Figure out installation path | ||
execute_process(COMMAND | ||
${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" | ||
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES 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") | ||
list(APPEND ADDITIONAL_MAKE_CLEAN_FILES freenect.c) | ||
|
||
# Compile the extension | ||
add_library(cython_freenect MODULE freenect.c) | ||
set_target_properties(cython_freenect PROPERTIES | ||
PREFIX "" | ||
OUTPUT_NAME "freenect" | ||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | ||
target_link_libraries(cython_freenect freenect_sync) | ||
include_directories(${PYTHON_INCLUDE_PATH} ../c_sync/) | ||
|
||
# Install the extension | ||
install(TARGETS cython_freenect | ||
DESTINATION ${PYTHON_SITE_PACKAGES}) | ||
|
||
# TODO: decide on what to do with demo_ scripts and were to install | ||
# them |