summaryrefslogtreecommitdiffstats
path: root/test/SWIG/module-spaces.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/SWIG/module-spaces.py')
-rw-r--r--test/SWIG/module-spaces.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/SWIG/module-spaces.py b/test/SWIG/module-spaces.py
index a0056f0..2833dff 100644
--- a/test/SWIG/module-spaces.py
+++ b/test/SWIG/module-spaces.py
@@ -30,6 +30,7 @@ the module name ; e.g. "%module test "
"""
import os.path
+import sys
import TestSCons
test = TestSCons.TestSCons()
@@ -44,15 +45,30 @@ Python_h = os.path.join(python_include, 'Python.h')
if not os.path.exists(Python_h):
test.skip_test('Can not find %s, skipping test.\n' % Python_h)
+# swig-python expects specific filenames.
+# the platform specific suffix won't necessarily work.
+if sys.platform == 'win32':
+ _dll = '.pyd'
+else:
+ _dll = '.so'
+
+# On Windows, build a 32-bit exe if on 32-bit python.
+if sys.platform == 'win32' and sys.maxsize <= 2**32:
+ swig_arch_var="TARGET_ARCH='x86',"
+else:
+ swig_arch_var=""
+
test.write(['SConstruct'], """\
env = Environment(SWIGFLAGS = '-python -c++',
+ %(swig_arch_var)s
CPPPATH=[r'%(python_include)s'],
SWIG=[r'%(swig)s'],
LIBPATH=[r'%(python_libpath)s'],
LIBS='%(python_lib)s',
+ LDMODULESUFFIX='%(_dll)s',
)
-env.LoadableModule('test1.so', ['test1.i', 'test1.cc'])
+env.LoadableModule('test1', ['test1.i', 'test1.cc'])
""" % locals())
test.write(['test1.cc'], """\
@@ -67,7 +83,7 @@ int test1func();
""")
test.write(['test1.i'], """\
-%module test1
+%module test1
%{
#include "test1.h"