1# EXTRA_DIST = cnghttp2.pxd nghttp2.pyx 2 3if(ENABLE_PYTHON_BINDINGS) 4 add_custom_target(python ALL 5 COMMAND "${PYTHON_EXECUTABLE}" setup.py build 6 VERBATIM 7 DEPENDS nghttp2.c nghttp2 8 ) 9 10 configure_file(install-python.cmake.in install-python.cmake ESCAPE_QUOTES @ONLY) 11 install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install-python.cmake") 12 13 add_custom_command(OUTPUT nghttp2.c 14 COMMAND "${CYTHON_EXECUTABLE}" -o nghttp2.c 15 "${CMAKE_CURRENT_SOURCE_DIR}/nghttp2.pyx" 16 VERBATIM 17 DEPENDS nghttp2.pyx 18 ) 19 20 # Instead of calling "setup.py clean --all", this should do... 21 set_directory_properties(PROPERTIES 22 ADDITIONAL_MAKE_CLEAN_FILES "build;python_nghttp2.egg-info" 23 ) 24 25## This works also, except that the installation target is missing... 26# include(UseCython) 27# cython_add_module(python_nghttp2 nghttp2.pyx) 28# set_target_properties(python_nghttp2 PROPERTIES 29# OUTPUT_NAME nghttp2 30# ) 31# target_include_directories(python_nghttp2 PRIVATE 32# "${CMAKE_SOURCE_DIR}/lib" 33# "${CMAKE_SOURCE_DIR}/lib/includes" 34# "${CMAKE_BINARY_DIR}/lib/includes" 35# ) 36# target_link_libraries(python_nghttp2 37# nghttp2 38# ) 39endif() 40