diff options
Diffstat (limited to 'pyk8055')
-rw-r--r-- | pyk8055/CMakeLists.txt | 12 | ||||
-rw-r--r-- | pyk8055/Makefile | 37 | ||||
-rw-r--r-- | pyk8055/setup.py | 38 |
3 files changed, 31 insertions, 56 deletions
diff --git a/pyk8055/CMakeLists.txt b/pyk8055/CMakeLists.txt new file mode 100644 index 0000000..33aa210 --- /dev/null +++ b/pyk8055/CMakeLists.txt @@ -0,0 +1,12 @@ + +INCLUDE(${SWIG_USE_FILE}) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +SET(CMAKE_SWIG_FLAGS "") + +SET_SOURCE_FILES_PROPERTIES(libk8055.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(libk8055.i PROPERTIES SWIG_FLAGS "-includeall") +SWIG_ADD_MODULE(pyk8055 python libk8055.i ${CMAKE_SOURCE_DIR}/libk8055/libk8055.c) +SWIG_LINK_LIBRARIES(pyk8055 ${PYTHON_LIBRARIES}) + diff --git a/pyk8055/Makefile b/pyk8055/Makefile deleted file mode 100644 index a2069d3..0000000 --- a/pyk8055/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# $Id: Makefile,v 1.3 2007/04/08 10:54:49 pjetur Exp $ -# -#cc = gcc -#pylibdir = pyk8055 -#libs = -lusb -L/usr/lib -lm - -# We have to build extension "inplace" if We're to -# run samples locally without installing - -all: libk8055.i ../libk8055.c - python setup.py build_ext --inplace - python setup.py build - -# Or in plain language -# swig -python libk8055.i -# cc -fpic -O2 -c ../libk8055.c -o ./libk8055.o -# cc -fpic -O2 -c libk8055_wrap.c -I /usr/include/python2.4/ -o libk8055_wrap.o -# ld -shared libk8055.o libk8055_wrap.o -lusb -o _pyk8055.so -## mv -f pyk8055.py __init__.py - -.PHONY: kdemo - -kdemo: k8055qt.py frmk8055qt.ui frmk8055qt.ui.h - pyuic frmk8055qt.ui -o frmk8055qt.py - -# install will both make build and install -install: - python setup.py install - -# Remove all swig generated files -clean: - python setup.py clean --all - rm -f *.o _pyk8055.so libk8055_wrap.c pyk8055.py pyk8055.pyc - -uninstall: - python setup.py uninstall - #rm -f /usr/lib/python-2.4/site-packages/pyk8055.py /usr/lib/python-2.4/site-packages/_pyk8055.so diff --git a/pyk8055/setup.py b/pyk8055/setup.py index b1a1c85..9b68581 100644 --- a/pyk8055/setup.py +++ b/pyk8055/setup.py @@ -5,27 +5,27 @@ from distutils.core import setup, Extension __revision__ = "$Id: setup.py,v 1.3 2007/03/28 10:17:57 pjetur Exp $" -if os.environ.has_key('VERSION'): - version=os.environ['VERSION'] +if 'VERSION' in os.environ: + version=os.environ['VERSION'] else: - from subprocess import * - try: - version = Popen(["grep ^VERSION ../Makefile | cut -d '=' -f 2 | tr -d '\n'"], stdout=PIPE, shell=True).communicate()[0] - except: - version='?.?' + from subprocess import * + try: + version = Popen(["grep ^VERSION ../Makefile | cut -d '=' -f 2 | tr -d '\n'"], stdout=PIPE, shell=True).communicate()[0] + except: + version='?.?' build_modules = [Extension('_pyk8055', - define_macros = [('VERSION', "\"%s\"" % str(version))], - libraries=["usb"], - sources=['libk8055.i',"../libk8055.c"])] - + define_macros = [('VERSION', "\"%s\"" % str(version))], + libraries=["usb"], + sources=['libk8055.i',"../libk8055/libk8055.c"])] + setup( - name='pyk8055', - version=version, - author='Pjetur G. Hjaltason', - author_email='pjetur@pjetur.net', - description='K8055 library wrapper', - url='http://libk8055.sourceforge.net/', - ext_modules =build_modules, - py_modules=['pyk8055'] + name='pyk8055', + version=version, + author='Pjetur G. Hjaltason', + author_email='pjetur@pjetur.net', + description='K8055 library wrapper', + url='http://libk8055.sourceforge.net/', + ext_modules =build_modules, + py_modules=['pyk8055'] ) |