summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct28
1 files changed, 21 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct
index a6659fe9b..fa2366963 100644
--- a/SConstruct
+++ b/SConstruct
@@ -182,7 +182,6 @@ for t in abs_targets:
env = Environment(ENV = os.environ, # inherit user's environment vars
ROOT = ROOT,
SRCDIR = SRCDIR)
-Export('env')
#Parse CC/CXX early so that we use the correct compiler for
# to test for dependencies/versions/libraries/includes
@@ -192,6 +191,8 @@ if ARGUMENTS.get('CC', None):
if ARGUMENTS.get('CXX', None):
env['CXX'] = ARGUMENTS.get('CXX')
+Export('env')
+
env.SConsignFile(joinpath(build_root,"sconsign"))
# Default duplicate option is to use hard links, but this messes up
@@ -269,16 +270,29 @@ if compare_versions(swig_version[2], min_swig_version) < 0:
Exit(1)
# Set up SWIG flags & scanner
-env.Append(SWIGFLAGS=Split('-c++ -python -modern $_CPPINCFLAGS'))
+swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
+env.Append(SWIGFLAGS=swig_flags)
+
+# filter out all existing swig scanners, they mess up the dependency
+# stuff for some reason
+scanners = []
+for scanner in env['SCANNERS']:
+ skeys = scanner.skeys
+ if skeys == '.i':
+ continue
+
+ if isinstance(skeys, (list, tuple)) and '.i' in skeys:
+ continue
-import SCons.Scanner
+ scanners.append(scanner)
+# add the new swig scanner that we like better
+from SCons.Scanner import ClassicCPP as CPPScanner
swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
+scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
-swig_scanner = SCons.Scanner.ClassicCPP("SwigScan", ".i", "CPPPATH",
- swig_inc_re)
-
-env.Append(SCANNERS = swig_scanner)
+# replace the scanners list that has what we want
+env['SCANNERS'] = scanners
# Platform-specific configuration. Note again that we assume that all
# builds under a given build root run on the same host platform.