Permalink
Browse files

Make Python SWIG module compile correctly on Windows.

For this to work, distutils.cfg must be configured for mingw32, and
the path to swig.exe must be specified to configure in the variable
SWIG.
  • Loading branch information...
1 parent 7f25c3a commit e37c5d061a03b1ac6aef63bc1cc012917cb7e550 @radarsat1 radarsat1 committed Nov 25, 2011
Showing with 14 additions and 17 deletions.
  1. +1 −1 Makefile.am
  2. +4 −9 configure.ac
  3. +2 −0 examples/Makefile.am
  4. +4 −4 examples/py_tk_gui/Makefile.am
  5. +3 −3 swig/Makefile.am
View
@@ -1,4 +1,4 @@
-SUBDIRS = src include test examples @SWIG@ @JNI@ @DOXYGEN@ extra
+SUBDIRS = src include test examples @SWIGDIR@ @JNI@ @DOXYGEN@ extra
EXTRA_DIST = libtool ltmain.sh autogen.sh libmapper.pc.in
View
@@ -109,15 +109,10 @@ if test x$swig_enabled = xyes; then
else
AM_PATH_PYTHON(2.3, [have_python="yes"], [have_python="no"])
if test x$have_python = xyes; then
- AC_CHECK_PROG([PYCONFIG], [python-config], [python-config])
- if test x$PYCONFIG = x; then
- swig_enabled=no
- swig_explain="(python-config not found)"
- else
- PYCFLAGS=$(python-config --cflags)
- PYLIBS=$(python-config --libs)
- AC_SUBST(SWIG)
- fi
+ SWIGDIR=swig
+ AC_SUBST(SWIGDIR)
+ PYEXT=$($PYTHON -c "import sys; print {'win32':'pyd','darwin':'dylib','linux2':'so'}[[sys.platform]]")
+ AC_SUBST(PYEXT)
else
swig_enabled=no
swig_explain="(python not found)"
View
@@ -2,8 +2,10 @@
SUBDIRS = pwm_synth
if HAVE_SWIG
+if HAVE_AUDIO
SUBDIRS += py_tk_gui
endif
+endif
if HAVE_AUDIO
bin_PROGRAMS = pwm_example
@@ -1,18 +1,18 @@
-all-local: _pwm.so $(top_builddir)/examples/pwm_synth/libpwm.la
+all-local: _pwm.$(PYEXT) $(top_builddir)/examples/pwm_synth/libpwm.la
$(builddir)/%_wrap.cxx $(buildir)/%.py: %.i
- swig -I$(top_srcdir)/examples/pwm_synth -I$(top_srcdir)/include -c++ \
+ $(SWIG) -I$(top_srcdir)/examples/pwm_synth -I$(top_srcdir)/include -c++ \
-python -o $(builddir)/pwm_wrap.cxx $(srcdir)/pwm.i
# Don't interfere with distutils CFLAGS
-_%.so: $(builddir)/%_wrap.cxx
+_%.$(PYEXT): $(builddir)/%_wrap.cxx
pwd
cd $(builddir) && env CFLAGS="" python setup.py build_ext
-@mv -v build/lib.*/$@ .
-@rm -rf build
clean-local:
- -@rm -vf _pwm.so pwm.py pwm_wrap.c
+ -@rm -vf _pwm.$(PYEXT) pwm.py pwm_wrap.c
EXTRA_DIST = pwm.i tk_pwm.py
View
@@ -1,12 +1,12 @@
-all-local: _mapper.so
+all-local: _mapper.$(PYEXT)
$(builddir)/%_wrap.c %.py: %.i
- swig -I$(top_srcdir)/include -python -o $(builddir)/mapper_wrap.c \
+ $(SWIG) -I$(top_srcdir)/include -python -o $(builddir)/mapper_wrap.c \
$(srcdir)/mapper.i
# Don't interfere with distutils CFLAGS
-_%.so: $(builddir)/%_wrap.c
+_%.$(PYEXT): $(builddir)/%_wrap.c
env CFLAGS="" python setup.py build_ext
-@cp -v build/lib.*/$@ .

0 comments on commit e37c5d0

Please sign in to comment.