summaryrefslogtreecommitdiffstats
path: root/cython/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Bryan Forbes2011-09-26 17:14:39 +0200
committerGravatar Nikias Bassen2011-09-26 17:14:39 +0200
commit2ca52d65bb113e8639e732f67fec3c3223c0a444 (patch)
treeb937e0c7a6a93eca914c0571bd71c85a3f2408b4 /cython/CMakeLists.txt
parent36ad4384303e94b19cdf7a5ff43182efebe1b398 (diff)
downloadlibplist-2ca52d65bb113e8639e732f67fec3c3223c0a444.tar.gz
libplist-2ca52d65bb113e8639e732f67fec3c3223c0a444.tar.bz2
Added cython bindings.
Diffstat (limited to 'cython/CMakeLists.txt')
-rw-r--r--cython/CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt
new file mode 100644
index 0000000..eac6bee
--- /dev/null
+++ b/cython/CMakeLists.txt
@@ -0,0 +1,30 @@
+
+INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_SOURCE_DIR} )
+
+
+SET(plist_SRC
+ ${CMAKE_CURRENT_BINARY_DIR}/plist.c )
+
+SET(plist_HDR
+ ${CMAKE_CURRENT_SOURCE_DIR}/plist.pxd )
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plist.c
+ COMMAND ${CYTHON_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/plist.c ${CMAKE_CURRENT_SOURCE_DIR}/plist.pyx
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/plist.pyx ${CMAKE_CURRENT_SOURCE_DIR}/plist.pxd
+)
+
+
+EXEC_PROGRAM("${PYTHON_EXECUTABLE}"
+ ARGS "-c 'try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1,0,\"${CMAKE_INSTALL_PREFIX}\")\nexcept: pass\n'"
+ OUTPUT_VARIABLE DISTUTILS_PYTHON_ILIBRARY_PATH
+ )
+
+PYTHON_ADD_MODULE(cython_plist plist.c plist_util.c)
+SET_TARGET_PROPERTIES(cython_plist PROPERTIES PREFIX "" OUTPUT_NAME plist)
+TARGET_LINK_LIBRARIES(cython_plist plist ${PYTHON_LIBRARIES})
+
+INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/plist${CMAKE_SHARED_MODULE_SUFFIX}
+ DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH} )
+INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/plist.pxd
+ DESTINATION include/plist/cython COMPONENT dev)