diff options
Diffstat (limited to 'scons')
-rw-r--r-- | scons/SConscript.common | 3 | ||||
-rw-r--r-- | scons/SConstruct | 6 | ||||
-rw-r--r-- | scons/SConstruct.common | 23 |
3 files changed, 20 insertions, 12 deletions
diff --git a/scons/SConscript.common b/scons/SConscript.common index a49cf0a..7fda32e 100644 --- a/scons/SConscript.common +++ b/scons/SConscript.common @@ -88,9 +88,6 @@ class EnvCreator: if env['PLATFORM'] == 'win32': env.Append(CCFLAGS=['/EHsc']) env.Append(CPPDEFINES='_HAS_EXCEPTIONS=1') - # Undoes the _TYPEINFO_ hack, which is unnecessary and only creates - # trouble when exceptions are enabled. - cls._Remove(env, 'CPPDEFINES', '_TYPEINFO_') cls._Remove(env, 'CPPDEFINES', '_HAS_EXCEPTIONS=0') else: env.Append(CCFLAGS='-fexceptions') diff --git a/scons/SConstruct b/scons/SConstruct index 1f2f37f..c749d6a 100644 --- a/scons/SConstruct +++ b/scons/SConstruct @@ -50,8 +50,12 @@ sconstruct_helper.Initialize(build_root_path='..', win_base = sconstruct_helper.MakeWinBaseEnvironment() +# We don't support VC 7.1 with exceptions disabled, so we always +# enable exceptions for VC 7.1. For newer versions of VC, we still +# compile with exceptions disabled by default, as that's a more common +# setting for our users. if win_base.get('MSVS_VERSION', None) == '7.1': - sconstruct_helper.AllowVc71StlWithoutExceptions(win_base) + sconstruct_helper.EnableExceptions(win_base) sconstruct_helper.MakeWinDebugEnvironment(win_base, 'win-dbg') sconstruct_helper.MakeWinOptimizedEnvironment(win_base, 'win-opt') diff --git a/scons/SConstruct.common b/scons/SConstruct.common index 7f6db15..cb9a63d 100644 --- a/scons/SConstruct.common +++ b/scons/SConstruct.common @@ -45,6 +45,13 @@ class SConstructHelper: # A dictionary to look up an environment by its name. self.env_dict = {} + def _Remove(self, env, attribute, value): + """Removes the given attribute value from the environment.""" + + attribute_values = env[attribute] + if value in attribute_values: + attribute_values.remove(value) + def Initialize(self, build_root_path, support_multiple_win_builds=False): test_env = Environment() platform = test_env['PLATFORM'] @@ -83,13 +90,14 @@ class SConstructHelper: # Enable scons -h Help(vars.GenerateHelpText(self.env_base)) - def AllowVc71StlWithoutExceptions(self, env): - env.Append( - CPPDEFINES = [# needed for using some parts of STL with exception - # disabled. The scoop is given here, with comments - # from P.J. Plauger at - # http://groups.google.com/group/microsoft.public.vc.stl/browse_thread/thread/5e719833c6bdb177?q=_HAS_EXCEPTIONS+using+namespace+std&pli=1 - '_TYPEINFO_']) + def EnableExceptions(self, env): + if env['PLATFORM'] == 'win32': + env.Append(CCFLAGS=['/EHsc']) + env.Append(CPPDEFINES='_HAS_EXCEPTIONS=1') + self._Remove(env, 'CPPDEFINES', '_HAS_EXCEPTIONS=0') + else: + env.Append(CCFLAGS='-fexceptions') + self._Remove(env, 'CCFLAGS', '-fno-exceptions') def MakeWinBaseEnvironment(self): win_base = self.env_base.Clone( @@ -117,7 +125,6 @@ class SConstructHelper: 'STRICT', 'WIN32_LEAN_AND_MEAN', '_HAS_EXCEPTIONS=0', - 'GTEST_ALLOW_VC71_WITHOUT_EXCEPTIONS_=1', ], LIBPATH=['#/$MAIN_DIR/lib'], LINKFLAGS=['-MACHINE:x86', # Enable safe SEH (not supp. on x64) |