Commit 3412f35e authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed generated wheel, no embed all required libraries + added sample

parent cc84db57
......@@ -34,14 +34,18 @@ add_custom_command(OUTPUT pylinphone.pyx setup.py
add_custom_command(OUTPUT pylinphone.so
COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext --inplace
DEPENDS pylinphone.pyx
setup.py)
setup.py
)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/linphone" DESTINATION .)
file(GLOB LINPHONE_LIBRARIES
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/*"
)
file(COPY ${LINPHONE_LIBRARIES} DESTINATION "./linphone/")
add_custom_command(OUTPUT pylinphone*.whl
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir .
DEPENDS pylinphone.so)
add_custom_target(pylinphone ALL DEPENDS pylinphone.pyx setup.py pylinphone.so pylinphone*.whl)
DEPENDS pylinphone.so
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pylinphone.so
DESTINATION ${CMAKE_INSTALL_LIBDIR}/
)
\ No newline at end of file
add_custom_target(pylinphone ALL DEPENDS pylinphone.pyx setup.py pylinphone.so pylinphone*.whl)
\ No newline at end of file
import os
from ctypes import CDLL
lib_path = os.path.join(os.path.dirname(__file__), 'liblinphone.so')
liblinphone_library = CDLL(lib_path)
from pylinphone import *
\ No newline at end of file
import linphone
print(linphone.Core.get_version())
import setuptools
from setuptools import setup, Distribution
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
......@@ -7,10 +7,18 @@ linphone_extension = Extension(
name="pylinphone",
sources=["pylinphone.pyx"],
libraries=["linphone"],
language="c",
library_dirs=["{{{lib_dir}}}"],
include_dirs=["{{{include_dir}}}"]
)
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
def is_pure(self):
return False
setup(
ext_modules = cythonize([linphone_extension]),
name="pylinphone",
......@@ -21,5 +29,8 @@ setup(
long_description="A python wrapper for linphone library automatically generated using pyrex",
long_description_content_type="plain/text",
url="https://linphone.org",
license="GPLv2"
license="GPLv2",
packages=['linphone'],
package_data={'linphone': ['*.so']},
distclass=BinaryDistribution
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment