diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-08-21 01:52:38 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-08-21 01:52:38 (GMT) |
commit | 678c769bc6189b5b7c301fbecfb37496725f6aee (patch) | |
tree | 0b0b37051a29dd48d2fb9c9c49a11182a276a0d9 /test/SWIG/live.py | |
parent | a035c43fb34cc888fca250f26f68fc2b03c018ac (diff) | |
download | SCons-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/live.py')
-rw-r--r-- | test/SWIG/live.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/SWIG/live.py b/test/SWIG/live.py index 4d4369e..7d79bae 100644 --- a/test/SWIG/live.py +++ b/test/SWIG/live.py @@ -36,7 +36,7 @@ import TestSCons # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. if sys.platform == 'win32': - _dll = '.dll' + _dll = '.pyd' else: _dll = '.so' @@ -55,6 +55,12 @@ if not os.path.exists(Python_h): # handle testing on other platforms: ldmodule_prefix = '_' +# 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("wrapper.py", """import os import sys @@ -64,11 +70,12 @@ os.system(" ".join(sys.argv[1:])) test.write('SConstruct', """\ foo = Environment(SWIGFLAGS='-python', + LIBPATH=[r'%(python_libpath)s'], CPPPATH=[r'%(python_include)s'], LDMODULEPREFIX='%(ldmodule_prefix)s', LDMODULESUFFIX='%(_dll)s', SWIG=[r'%(swig)s'], - LIBPATH=[r'%(python_libpath)s'], + %(swig_arch_var)s LIBS='%(python_lib)s', ) |