From: <sv...@ww...> - 2005-01-30 22:10:29
|
Author: mkrose Date: 2005-01-30 14:10:22 -0800 (Sun, 30 Jan 2005) New Revision: 1455 Modified: trunk/CSP/tools/build.py Log: SCons build script enhancements: - fix swig dependency tracking. - add a utility class for setting global build configurations. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1455 Modified: trunk/CSP/tools/build.py =================================================================== --- trunk/CSP/tools/build.py 2005-01-30 21:35:45 UTC (rev 1454) +++ trunk/CSP/tools/build.py 2005-01-30 22:10:22 UTC (rev 1455) @@ -400,7 +400,31 @@ SConsEnvironment.Documentation = MakeDocumentation +class GlobalSettings: + def __init__(self, config=None): + self._platform = sys.platform + self._config = config + self._dict = {} + def IsWindows(self): + return self._platform.startswith('win') + def IsLinux(self): + return self._platform.startswith('linux') + def UnsupportedPlatform(self): + print 'Platform "%s" not supported' % self._platform + sys.exit(1) + def __setattr__(self, key, value): + if key.startswith('_'): + self.__dict__[key] = value + else: + self._dict[key] = value + def env(self): + env = SCons.Environment.Environment(**self._dict) + GlobalSetup(env) + if self._config is not None: + env.SetConfig(self._config) + return env + ############################################################################ # ENHANCED SWIG SUPPORT @@ -430,7 +454,7 @@ def AddSwigDep(env): def SwigScanner(node, env, path, arg=None): - cmd = env.subst('$SWIG -MM $_CPPINCFLAGS %s' % str(node)) + cmd = env.subst('$SWIG $SWIGFLAGS $SWIGINCLUDES -MM %s' % str(node)) stdin, stdout, stderr = os.popen3(cmd, 't') deps = ''.join(map(lambda x: x.strip(), stdout.readlines())) deps = map(lambda x: "#/"+x.strip(), deps.split('\\'))[1:] |