64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
|
|
||
|
# This is a CMake example for Python
|
||
|
|
||
|
INCLUDE(${SWIG_USE_FILE})
|
||
|
|
||
|
if (PYTHONLIBS_FOUND)
|
||
|
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
|
||
|
|
||
|
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/CXX)
|
||
|
|
||
|
SET(CMAKE_SWIG_FLAGS "")
|
||
|
|
||
|
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTIES CPLUSPLUS ON)
|
||
|
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTIES SWIG_FLAGS "-includeall")
|
||
|
|
||
|
SET( CMAKE_SWIG_OUTDIR "${PROJECT_BINARY_DIR}/yap" )
|
||
|
|
||
|
|
||
|
SWIG_ADD_MODULE(py python ../yap.i )
|
||
|
|
||
|
SWIG_LINK_LIBRARIES (py Yap++ )
|
||
|
|
||
|
|
||
|
add_dependencies(py Yap++ )
|
||
|
|
||
|
configure_file ("setup.py.cmake"
|
||
|
"yap/setup.py" )
|
||
|
|
||
|
add_custom_target ( PyYAP ALL
|
||
|
COMMAND ${PYTHON_EXECUTABLE} setup.py install
|
||
|
WORKING_DIRECTORY "yap"
|
||
|
DEPENDS python Yap++)
|
||
|
|
||
|
|
||
|
if ( DOCUMENTATION AND DOXYGEN_FOUND )
|
||
|
|
||
|
set(CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
|
||
|
|
||
|
# Run doxygen to only generate the xml
|
||
|
add_custom_command ( OUTPUT ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
|
||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/doc
|
||
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile.xml
|
||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||
|
DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}
|
||
|
)
|
||
|
|
||
|
# generate .i from doxygen .xml
|
||
|
add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i
|
||
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
|
||
|
${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i
|
||
|
DEPENDS ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
|
||
|
)
|
||
|
add_custom_target ( doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i )
|
||
|
add_dependencies( ${SWIG_MODULE_ftdi1_REAL_NAME} doc_i )
|
||
|
|
||
|
endif ()
|
||
|
|
||
|
|
||
|
# add_subdirectory ( examples )
|
||
|
else ()
|
||
|
message(STATUS "Not building python bindings")
|
||
|
endif(PYTHONLIBS_FOUND)
|