[Libxtract-commits] SF.net SVN: libxtract: [90] trunk
Status: Alpha
Brought to you by:
postlude
From: <pos...@us...> - 2007-09-04 19:07:57
|
Revision: 90 http://libxtract.svn.sourceforge.net/libxtract/?rev=90&view=rev Author: postlude Date: 2007-09-04 12:07:55 -0700 (Tue, 04 Sep 2007) Log Message: ----------- Added basic SWIG wrapper generator (use ./configure --enable-swig etc) Modified Paths: -------------- trunk/ChangeLog trunk/Makefile.am trunk/autogen.sh trunk/configure.in trunk/src/scalar.c Added Paths: ----------- trunk/bootstrap trunk/swig/ trunk/swig/Makefile.am trunk/swig/test.py trunk/swig/xtract.i Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-09-03 15:03:21 UTC (rev 89) +++ trunk/ChangeLog 2007-09-04 19:07:55 UTC (rev 90) @@ -1,3 +1,7 @@ +2007-09-04 Jamie Bullock <ja...@po...> + * version 0.4.8 + * Added cursory SWIG Python wrapper generator + 2007-04-20 Jamie Bullock <ja...@po...> * version 0.4.7 * Added MSP example Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2007-09-03 15:03:21 UTC (rev 89) +++ trunk/Makefile.am 2007-09-04 19:07:55 UTC (rev 90) @@ -1,7 +1,14 @@ -MAINTAINERCLEANFILES = Makefile.in configure depcomp compile config.guess ltmain.sh config.sub missing install-sh aclocal.m4 config.h.in config.h.in~ +MAINTAINERCLEANFILES = Makefile.in configure depcomp compile config.guess ltmain.sh config.sub missing install-sh aclocal.m4 config.h.in config.h.in~ py-compile -SUBDIRS = src xtract examples @DOXYGEN@ +if BUILD_SWIG +SWIG_DIR = swig +endif +SUBDIRS = src xtract examples $(SWIG_DIR) @DOXYGEN@ + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libxtract.pc +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = bootstrap autogen.sh README TODO Modified: trunk/autogen.sh =================================================================== --- trunk/autogen.sh 2007-09-03 15:03:21 UTC (rev 89) +++ trunk/autogen.sh 2007-09-04 19:07:55 UTC (rev 90) @@ -8,11 +8,11 @@ case `uname -s` in Linux) LIBTOOLIZE=libtoolize - ACLOCALARGS='' + ACLOCALARGS='-I m4' ;; Darwin) LIBTOOLIZE=glibtoolize - ACLOCALARGS='-I /usr/share/aclocal' + ACLOCALARGS='-I /usr/share/aclocal -I m4' ;; *) echo error: unrecognized OS exit 1 Added: trunk/bootstrap =================================================================== --- trunk/bootstrap (rev 0) +++ trunk/bootstrap 2007-09-04 19:07:55 UTC (rev 90) @@ -0,0 +1,4 @@ +#!/bin/sh + +autoreconf --force --install -I config -I m4 + Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2007-09-03 15:03:21 UTC (rev 89) +++ trunk/configure.in 2007-09-04 19:07:55 UTC (rev 90) @@ -4,13 +4,13 @@ # Increment for feature additions and enhancements m4_define(libxtract_minor_version, 4) # Increment for fixes -m4_define(libxtract_fix_version, 7) +m4_define(libxtract_fix_version, 8) m4_define(libxtract_version, libxtract_major_version.libxtract_minor_version.libxtract_fix_version) PACKAGE=libxtract -AC_INIT(libxtract, libxtract_version, bu...@po...) +AC_INIT(libxtract, libxtract_version, lib...@li...) AC_DEFINE(LIBXTRACT_VERSION, libxtract_version, [LibXtract Version]) AM_INIT_AUTOMAKE($PACKAGE, $LIBXTRACT_VERSION) AM_CONFIG_HEADER(config.h) @@ -64,7 +64,7 @@ # age to 0. XTRACT_SO_VERSION=0:0:0 -CFLAGS="$CFLAGS -pedantic -ansi -Wall -Werror -std=c99 -I/usr/local/include" +CFLAGS="$CFLAGS -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include" LDFLAGS="$LDFLAGS -lm" AC_ARG_WITH(pd_dir, @@ -124,6 +124,7 @@ AM_CONDITIONAL(BUILD_PD_EXAMPLE, test "x${pd_example}" = 'xtrue') + dnl Enable debugging (no) AC_ARG_ENABLE(debug, [ --enable-debug[[=value]] compile with debug [[default=no]]], @@ -135,6 +136,25 @@ CFLAGS="$CFLAGS -O0 -ggdb -g" fi +AC_ARG_ENABLE(swig, + [ --enable-swig Generate swig bindings], + [case "${enableval}" in + yes) swig=true ;; + no) swig=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-swig) ;; + esac],[swig=false]) + + +dnl SWIG stuff +if [[ "$swig" = "true" ]] ; then + AC_PROG_SWIG(1.3.21) + AM_PATH_PYTHON + SWIG_PYTHON + AC_DEFINE([BUILD_SWIG], [1], [Build the swig bindings]) +fi + +AM_CONDITIONAL(BUILD_SWIG, test "x${swig}" = 'xtrue') + dnl ------------------------------------------ dnl ---- do some magic to gues the host opsys dnl ---- taken from libvorbis configure.in @@ -212,7 +232,7 @@ AC_CONFIG_FILES([doc/documentation.doxygen libxtract.pc]) -AC_OUTPUT(Makefile src/Makefile xtract/Makefile doc/Makefile examples/Makefile examples/puredata/Makefile examples/simpletest/Makefile) +AC_OUTPUT(Makefile src/Makefile xtract/Makefile doc/Makefile examples/Makefile examples/puredata/Makefile examples/simpletest/Makefile swig/Makefile) echo echo "**************************************************************" @@ -240,7 +260,11 @@ else echo "PD external: no" fi - +if test "$swig" == "true"; then + echo "SWIG Python bindings: yes" +else + echo "SWIG Python bindings: no" +fi echo echo "**************************************************************" echo Modified: trunk/src/scalar.c =================================================================== --- trunk/src/scalar.c 2007-09-03 15:03:21 UTC (rev 89) +++ trunk/src/scalar.c 2007-09-04 19:07:55 UTC (rev 90) @@ -39,10 +39,12 @@ int xtract_mean(const float *data, const int N, const void *argv, float *result){ int n = N; + + *result = 0.f; while(n--) *result += data[n]; - + *result /= N; return XTRACT_SUCCESS; Added: trunk/swig/Makefile.am =================================================================== --- trunk/swig/Makefile.am (rev 0) +++ trunk/swig/Makefile.am 2007-09-04 19:07:55 UTC (rev 90) @@ -0,0 +1,18 @@ +MAINTAINERCLEANFILES = xtract.py xtract_wrap.c Makefile.in _xtract.so + +BUILT_SOURCES = $(srcdir)/xtract_wrap.c +SWIG_SOURCES = xtract.i + +pkgpython_PYTHON = xtract.py +pkgpyexec_LTLIBRARIES = _xtract.la +_xtract_la_SOURCES = $(srcdir)/xtract_wrap.c $(SWIG_SOURCES) +_xtract_la_CFLAGS = $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src +_xtract_la_LDFLAGS = -module -lxtract +_xtract_la_LIBADD = ../src/libxtract.la + +xtract_wrap.c : $(SWIG_SOURCES) + $(SWIG) $(SWIG_PYTHON_OPT) -I$(top_srcdir) -o $@ $< + +clean-local: + -rm -f _xtract.so xtract.py xtract_wrap.c xtract.pyc + Added: trunk/swig/test.py =================================================================== --- trunk/swig/test.py (rev 0) +++ trunk/swig/test.py 2007-09-04 19:07:55 UTC (rev 90) @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import xtract + +len = 5 + +a = xtract.new_floatArray(len) + +for i in range(0, len): + xtract.floatArray_setitem(a, i, 2*i) + +retval,result = xtract.xtract_mean(a,len,None) + +print result + + + + Added: trunk/swig/xtract.i =================================================================== --- trunk/swig/xtract.i (rev 0) +++ trunk/swig/xtract.i 2007-09-04 19:07:55 UTC (rev 90) @@ -0,0 +1,12 @@ +%module xtract +%include carrays.i +%include typemaps.i + +%{ +#include "xtract/xtract_scalar.h" +%} + +%array_functions(float, floatArray); +%apply float *OUTPUT { float *result }; + +%include "xtract/xtract_scalar.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |