summaryrefslogtreecommitdiffstats
path: root/test/SWIG/build-dir.py
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2014-08-21 01:52:38 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2014-08-21 01:52:38 (GMT)
commit678c769bc6189b5b7c301fbecfb37496725f6aee (patch)
tree0b0b37051a29dd48d2fb9c9c49a11182a276a0d9 /test/SWIG/build-dir.py
parenta035c43fb34cc888fca250f26f68fc2b03c018ac (diff)
downloadSCons-678c769bc6189b5b7c301fbecfb37496725f6aee.zip
SCons-678c769bc6189b5b7c301fbecfb37496725f6aee.tar.gz
SCons-678c769bc6189b5b7c301fbecfb37496725f6aee.tar.bz2
SWIG: improve tool detection, and update SWIG tests to run on Windows.
The tool detection is improved by checking for swig in env['SWIG'], where it is commonly set, as well as env['ENV']['PATH']. The tests mostly didn't work on Windows. I updated them all. Mostly to build 32-bit extensions when using 32-bit python on Windows, and use .pyd as the python extension on Windows.
Diffstat (limited to 'test/SWIG/build-dir.py')
-rw-r--r--test/SWIG/build-dir.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py
index 4e5bfe9..304932f 100644
--- a/test/SWIG/build-dir.py
+++ b/test/SWIG/build-dir.py
@@ -45,7 +45,7 @@ if not swig:
if sys.platform == 'win32':
_dll = '.dll'
else:
- _dll = '.so'
+ _dll = '.so'
test.subdir(['source'])
@@ -55,11 +55,17 @@ 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)
+if sys.platform == 'win32' and sys.maxsize <= 2**32:
+ swig_arch_var="TARGET_ARCH='x86',"
+else:
+ swig_arch_var=""
+
test.write(['SConstruct'], """\
#
# Create the build environment.
#
env = Environment(CPPPATH = [".", r'%(python_include)s'],
+ %(swig_arch_var)s
CPPDEFINES = "NDEBUG",
SWIG = [r'%(swig)s'],
SWIGFLAGS = ["-python", "-c++"],
@@ -123,11 +129,11 @@ class Vector
public:
Vector(int n = 0);
~Vector();
-
+
%extend
{
const char* __str__() { return "linalg.Vector()"; }
-
+
%pythoncode %{
def __iter__(self):
for i in range(len(self)):