summaryrefslogtreecommitdiffstats
path: root/cython/CMakeLists.txt
blob: eac6beea316f541482a59e80cbe453b2f07ffb89 (plain)
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
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)