From 8dcd437ce17a20529b5f835bae821964a338951c Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 6 Jul 2004 07:50:58 +0000 Subject: [PATCH] Use EHsc option instead of GX. Don't add Og and GX options on 8.0. [SVN r23364] --- src/tools/msvc.jam | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 7584ce878..e1b45636d 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -108,6 +108,29 @@ rule init ( flags msvc.link .LD $(condition) : $(prefix)$(linker) ; flags msvc.archive .LD $(condition) : $(prefix)$(linker) ; + if ! $(version) + { + # Even if version is not explicitly specified, try to detect the version + # from the path. + if [ MATCH "(Microsoft Visual Studio 8)" : $(command) ] + { + version = 8.0 ; + } + else if [ MATCH "(\\.NET 2003\\VC7)" : $(command) ] || + [ MATCH "(Microsoft Visual C\\+\\+ Toolkit 2003)" : $(command) ] + { + version = 7.1 ; + } + else if [ MATCH "(.NET\\VC7)" : $(command) ] + { + version = 7.0 ; + } + else + { + version = 6.0 ; + } + } + # The following options work only for 7* versions. It means # that if the user has not specified a version he gets 6.0 compatible # behavious (i.e. a bit buggy) @@ -116,6 +139,17 @@ rule init ( flags msvc.compile CFLAGS $(condition) : /Zc:forScope /Zc:wchar_t ; } + # 8.0 deprecates some of the options + if [ MATCH ^(8) : $(version) ] + { + flags msvc.compile CFLAGS $(condition)/speed : /O2 ; + flags msvc.compile CFLAGS $(condition)/space : /O1 ; + } + else + { + flags msvc.compile CFLAGS $(condition)/speed : /Ogity /O2 /Gs ; + flags msvc.compile CFLAGS $(condition)/space : /Ogisy /O1 /Gs ; + } } rule default-paths ( version ? ) @@ -136,6 +170,7 @@ rule default-paths ( version ? ) local version-7-path = $(ProgramFiles)"\\Microsoft Visual Studio .NET\\VC7" ; local version-7.0-path = $(version-7-path) ; local version-7.1-path = $(ProgramFiles)"\\Microsoft Visual Studio .NET 2003\\VC7" ; + local version-8.0-path = $(ProgramFiles)"\\Microsoft Visual Studio 8" ; local VS71COMNTOOLS = [ modules.peek : VS71COMNTOOLS ] ; if $(VS71COMNTOOLS) @@ -191,12 +226,10 @@ feature.feature debug-store : object database : propagated ; flags msvc.compile CFLAGS on/object : /Z7 ; flags msvc.compile CFLAGS on/database : /Zi ; flags msvc.compile CFLAGS off : /Od ; -flags msvc.compile CFLAGS speed : /Ogity /O2 /Gs ; -flags msvc.compile CFLAGS space : /Ogisy /O1 /Gs ; flags msvc.compile CFLAGS off : /Ob0 ; flags msvc.compile CFLAGS on : /Ob1 ; flags msvc.compile CFLAGS full : /Ob2 ; -flags msvc.compile CFLAGS on : /GX ; +flags msvc.compile CFLAGS on : /EHsc ; flags msvc.compile CFLAGS on : /GR ; flags msvc.compile CFLAGS off/shared : /MD ; flags msvc.compile CFLAGS on/shared : /MDd ; @@ -205,7 +238,7 @@ flags msvc.compile CFLAGS off/static/on/static/single : /MLd ; flags msvc.compile CFLAGS off/static/multi : /MT ; flags msvc.compile CFLAGS on/static/multi : /MTd ; -flags msvc.compile CFLAGS CPP : /GX ; +flags msvc.compile CFLAGS CPP : /EHsc ; flags msvc.compile USER_CFLAGS : ; flags msvc.compile.c++ USER_CFLAGS : ;