Commit 5880a5fd authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed first build issue if python wrapper enabled

parent 3412f35e
......@@ -20,32 +20,34 @@
#
############################################################################
add_custom_command(OUTPUT pylinphone.pyx setup.py
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml" "-i" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}" "-l" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
configure_file("setup.cmake" "setup.py" @ONLY)
add_custom_command(OUTPUT pylinphone.pyx
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml"
DEPENDS ${PROJECT_SOURCE_DIR}/tools/genapixml.py
${PROJECT_SOURCE_DIR}/tools/metadoc.py
${PROJECT_SOURCE_DIR}/tools/abstractapi.py
genwrapper.py
pylinphone.mustache
setup.mustache
linphone-doc
)
add_custom_command(OUTPUT pylinphone.so
COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext --inplace
DEPENDS pylinphone.pyx
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 .
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir ${CMAKE_INSTALL_PREFIX}/
DEPENDS pylinphone.so
)
add_custom_target(pylinphone ALL DEPENDS pylinphone.pyx setup.py pylinphone.so pylinphone*.whl)
\ No newline at end of file
add_custom_target(pylinphone ALL DEPENDS pylinphone.pyx pylinphone.so pylinphone*.whl)
add_custom_command(TARGET pylinphone
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/*" "./linphone/"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/src/liblinphone.so" "./linphone/"
)
add_dependencies(pylinphone linphone)
\ No newline at end of file
......@@ -488,12 +488,6 @@ class Pylinphone(object):
_obj['methods'].extend(self.factory_constructors)
break
class Setup(object):
def __init__(self, version, lib, include):
self.version = version
self.lib_dir = lib
self.include_dir = include
###############################################################################
def render(renderer, item, path):
......@@ -514,8 +508,6 @@ if __name__ == '__main__':
argparser = argparse.ArgumentParser(description='Generate source files for the Python wrapper')
argparser.add_argument('xmldir', type=str, help='Directory where the XML documentation of the Linphone\'s API generated by Doxygen is placed')
argparser.add_argument('-o --output', type=str, help='the directory where to generate the source files', dest='outputdir', default='.')
argparser.add_argument('-l --libdir', type=str, help='the directory where the liblinphone.so is installed', dest='lib_dir', default='.')
argparser.add_argument('-i --includedir', type=str, help='the directory where the headers are installed', dest='include_dir', default='.')
args = argparser.parse_args()
loglevel = logging.INFO
......@@ -554,7 +546,4 @@ if __name__ == '__main__':
renderer = pystache.Renderer()
wrapper = Pylinphone(parser)
setup = Setup(git_version, args.lib_dir, args.include_dir)
render(renderer, wrapper, args.outputdir + '/pylinphone.pyx')
render(renderer, setup, args.outputdir + '/setup.py')
......@@ -8,8 +8,8 @@ linphone_extension = Extension(
sources=["pylinphone.pyx"],
libraries=["linphone"],
language="c",
library_dirs=["{{{lib_dir}}}"],
include_dirs=["{{{include_dir}}}"]
library_dirs=["@PROJECT_BINARY_DIR@/src"],
include_dirs=["@PROJECT_SOURCE_DIR@/include", "@BELLESIP_INCLUDE_DIRS@", "@BCTOOLBOX_INCLUDE_DIRS@"]
)
class BinaryDistribution(Distribution):
......@@ -22,7 +22,7 @@ class BinaryDistribution(Distribution):
setup(
ext_modules = cythonize([linphone_extension]),
name="pylinphone",
version="{{version}}",
version="@LINPHONESDK_VERSION@",
author="Belledonne Communications",
author_email="info@belledonne-communications.com",
description="A python wrapper for linphone library",
......
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