diff options
Diffstat (limited to 'bindings/python')
-rw-r--r-- | bindings/python/CMakeLists.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt new file mode 100644 index 00000000..4d410339 --- /dev/null +++ b/bindings/python/CMakeLists.txt @@ -0,0 +1,26 @@ +project(libssh-python CXX) + +set(SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ssh_python.cpp") + +find_package(PythonInterp REQUIRED) +execute_process( + COMMAND + ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib())" + OUTPUT_VARIABLE + PYTHON_LIB_DIR +) + +if (NOT PYTHON_SITEDIR) + set(PYTHON_SITEDIR ${PYTHON_LIB_DIR}) +endif (NOT PYTHON_SITEDIR) + +include_directories(${LIBSSH_PUBLIC_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH}) + +set_source_files_properties(${SWIG_INPUT} PROPERTIES CPLUSPLUS ON) +# Py_True and Py_False are a bit tricky +set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing") +swig_add_module(ssh python ${SWIG_INPUT}) +swig_link_libraries(ssh ${LIBSSH_SHARED_LIBRARY} ${PYTHON_LIBRARIES}) + +install(TARGETS ${SWIG_MODULE_ssh_REAL_NAME} LIBRARY DESTINATION ${PYTHON_SITEDIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ssh.py DESTINATION ${PYTHON_SITEDIR}) |