INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )

INCLUDE( ${SWIG_USE_FILE} )

SET(CMAKE_SWIG_FLAGS -Werror -Wall -modern)

FIND_PACKAGE( OpenSync REQUIRED )

FILE(GLOB SWIG_MODULE_opensync_EXTRA_DEPS opensync-*.i)
SWIG_ADD_MODULE( opensync python opensync.i )
SWIG_LINK_LIBRARIES( opensync opensync ${PYTHON_LIBRARIES} )

# this is a modified version of the python module generated by SWIG
# we edit the python source to make the opensync.Error class an exception, allowing it to be raised
# FIXME: find a way (if it exists) of getting SWIG to do this for us
ADD_CUSTOM_COMMAND(TARGET ${SWIG_MODULE_opensync_REAL_NAME} POST_BUILD
   COMMAND sed ARGS "s/^class Error(object):/class Error(Exception):/" opensync.py > opensync_hack.py
   COMMENT "Munging SWIG-generated Python class"
   VERBATIM)

INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/_opensync.so
   DESTINATION ${LIB_INSTALL_DIR}/python/site-packages/ )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/opensync_hack.py
   DESTINATION ${LIB_INSTALL_DIR}/python/site-packages/ RENAME opensync.py )

INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )

INCLUDE( ${SWIG_USE_FILE} )

SET(CMAKE_SWIG_FLAGS -Werror -Wall -modern)

FIND_PACKAGE( OpenSync REQUIRED )

FILE(GLOB SWIG_MODULE_opensync_EXTRA_DEPS opensync-*.i)
SWIG_ADD_MODULE( opensync python opensync.i )
SWIG_LINK_LIBRARIES( opensync opensync ${PYTHON_LIBRARIES} )

# this is a modified version of the python module generated by SWIG
# we edit the python source to make the opensync.Error class an exception, allowing it to be raised
# FIXME: find a way (if it exists) of getting SWIG to do this for us
ADD_CUSTOM_COMMAND(TARGET ${SWIG_MODULE_opensync_REAL_NAME} POST_BUILD
   COMMAND sed ARGS "s/^class Error(object):/class Error(Exception):/" opensync.py > opensync_hack.py
   COMMENT "Munging SWIG-generated Python class"
   VERBATIM)

INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/_opensync.so
   DESTINATION ${LIB_INSTALL_DIR}/python/site-packages/ )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/opensync_hack.py
   DESTINATION ${LIB_INSTALL_DIR}/python${PYTHON_VERSION}/site-packages/ RENAME opensync.py )

Install the python wrapper in versioned python site-package directory.
Install the python wrapper in versioned python site-package directory.


git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@2718 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e
