--- msvc.original.jam Thu Sep 23 08:52:34 2010 +++ msvc.jam Thu Sep 23 08:42:55 2010 @@ -598,6 +598,27 @@ # ################################################################################ +# Gets the path specified by the first of: +# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\$(entry) : $(value-name) +# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\$(entry) : $(value-name) +# Returns the path if found +# +local rule get-path-in-registry ( entry : value-name ) +{ + local path ; + for local x in "" "Wow6432Node\\" + { + path += [ W32_GETREG + "HKEY_LOCAL_MACHINE\\SOFTWARE\\"$(x)"\\Microsoft\\"$(entry) + : $(value-name) ] ; + } + if $(path) + { + path = [ path.make-NT $(path[1]) ] ; + return $(path) ; + } +} + # Detects versions listed as '.known-versions' by checking registry information, # environment variables & default paths. Supports both native Windows and # Cygwin. @@ -611,18 +632,12 @@ { if $(.version-$(i)-reg) { - local vc-path ; - for local x in "" "Wow6432Node\\" - { - vc-path += [ W32_GETREG - "HKEY_LOCAL_MACHINE\\SOFTWARE\\"$(x)"\\Microsoft\\"$(.version-$(i)-reg) - : "ProductDir" ] ; - } + local vc-path = [ get-path-in-registry $(.version-$(i)-reg) : "ProductDir" ] ; if $(vc-path) { - vc-path = [ path.join [ path.make-NT $(vc-path[1]) ] "bin" ] ; - register-configuration $(i) : [ path.native $(vc-path[1]) ] ; + vc-path = [ path.join $(vc-path) "bin" ] ; + register-configuration $(i) : [ path.native $(vc-path) ] ; } } } @@ -744,6 +759,7 @@ # Generate and register setup command. local below-8.0 = [ MATCH ^([67]\\.) : $(version) ] ; + local sdk = [ MATCH (sdk) : $(version) ] ; local cpu = i386 amd64 ia64 ; if $(below-8.0) @@ -795,13 +811,32 @@ # distributions does not include this top level script but to # support those we need to fall back to using the worker scripts # directly in case the top level script can not be found. + # + # Windows SDK 7.0 & 7.1 includes vcvarsall.bat and vcvars32.bat but + # does not include support for 64 bit AMD or 64 bit Itanium through + # vcvars*.bat scripts. Instead it provides a different SetEnv.Cmd + # script which acts like vcvarsall.bat but takes different options + # and is placed in the SDK Bin directory rather than the Visual + # Studio Bin directory. local global-setup = [ feature.get-values : $(options) ] ; global-setup = $(global-setup[1]) ; if ! $(below-8.0) { - global-setup ?= [ locate-default-setup $(command) : $(parent) : - vcvarsall.bat ] ; + if $(sdk) + { + local sdk-path = [ get-path-in-registry $(.version-$(version)-sdkreg) : "InstallationFolder" ] ; + if $(sdk-path) + { + sdk-path = [ path.native $(sdk-path) ] ; + global-setup ?= [ locate-default-setup $(command) : $(sdk-path) : SetEnv.cmd ] ; + } + } + else + { + global-setup ?= [ locate-default-setup $(command) : $(parent) : + vcvarsall.bat ] ; + } } local default-setup-amd64 = vcvarsx86_amd64.bat ; @@ -815,30 +850,45 @@ local default-global-setup-options-amd64 = x86_amd64 ; local default-global-setup-options-i386 = x86 ; local default-global-setup-options-ia64 = x86_ia64 ; - - # When using 64-bit Windows, and targeting 64-bit, it is possible to - # use a native 64-bit compiler, selected by the "amd64" & "ia64" - # parameters to vcvarsall.bat. There are two variables we can use -- - # PROCESSOR_ARCHITECTURE and PROCESSOR_IDENTIFIER. The first is - # 'x86' when running 32-bit Windows, no matter which processor is - # used, and 'AMD64' on 64-bit windows on x86 (either AMD64 or EM64T) - # Windows. - # - if [ MATCH ^(AMD64) : [ os.environ PROCESSOR_ARCHITECTURE ] ] + + if $(sdk) { - default-global-setup-options-amd64 = amd64 ; + default-global-setup-options-amd64 = /x64 ; + default-global-setup-options-i386 = /x86 ; + default-global-setup-options-ia64 = /ia64 ; } - # TODO: The same 'native compiler usage' should be implemented for - # the Itanium platform by using the "ia64" parameter. For this - # though we need someone with access to this platform who can find - # out how to correctly detect this case. - else if $(somehow-detect-the-itanium-platform) + else { - default-global-setup-options-ia64 = ia64 ; + # When using 64-bit Windows, and targeting 64-bit, it is possible to + # use a native 64-bit compiler, selected by the "amd64" & "ia64" + # parameters to vcvarsall.bat. There are two variables we can use -- + # PROCESSOR_ARCHITECTURE and PROCESSOR_IDENTIFIER. The first is + # 'x86' when running 32-bit Windows, no matter which processor is + # used, and 'AMD64' on 64-bit windows on x86 (either AMD64 or EM64T) + # Windows. + # + if [ MATCH ^(AMD64) : [ os.environ PROCESSOR_ARCHITECTURE ] ] + { + default-global-setup-options-amd64 = amd64 ; + } + # TODO: The same 'native compiler usage' should be implemented for + # the Itanium platform by using the "ia64" parameter. For this + # though we need someone with access to this platform who can find + # out how to correctly detect this case. + else if $(somehow-detect-the-itanium-platform) + { + default-global-setup-options-ia64 = ia64 ; + } } local setup-prefix = "call " ; local setup-suffix = " >nul"$(.nl) ; + # The Windows SDK setup script needs /E:ON and /V:ON + if $(sdk) + { + setup-prefix = "cmd.exe /E:ON /V:ON /S /C \"call " ; + setup-suffix = " >nul 2>&1 && " ; + } if ! [ os.name ] in NT { setup-prefix = "cmd.exe /S /C call " ; @@ -1323,7 +1373,7 @@ # Known toolset versions, in order of preference. -.known-versions = 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1 7.1toolkit 7.0 6.0 ; +.known-versions = 10.0 10.0express 10.0sdk7.1 9.0 9.0express 9.0sdk7.0 8.0 8.0express 7.1 7.1toolkit 7.0 6.0 ; # Version aliases. .version-alias-6 = 6.0 ; @@ -1331,7 +1381,9 @@ .version-alias-7 = 7.0 ; .version-alias-8 = 8.0 ; .version-alias-9 = 9.0 ; +.version-alias-sdk7.0 = 9.0sdk7.0 ; .version-alias-10 = 10.0 ; +.version-alias-sdk7.1 = 10.0sdk7.1 ; # Names of registry keys containing the Visual C++ installation path (relative # to "HKEY_LOCAL_MACHINE\SOFTWARE\\Microsoft"). @@ -1342,8 +1394,12 @@ .version-8.0express-reg = "VCExpress\\8.0\\Setup\\VC" ; .version-9.0-reg = "VisualStudio\\9.0\\Setup\\VC" ; .version-9.0express-reg = "VCExpress\\9.0\\Setup\\VC" ; +.version-9.0sdk7.0-reg = "VisualStudio\\9.0\\Setup\\VC" ; +.version-9.0sdk7.0-sdkreg = "Microsoft SDKs\\Windows\\v7.0\\WinSDKTools" ; .version-10.0-reg = "VisualStudio\\10.0\\Setup\\VC" ; .version-10.0express-reg = "VCExpress\\10.0\\Setup\\VC" ; +.version-10.0sdk7.1-reg = "VisualStudio\\10.0\\Setup\\VC" ; +.version-10.0sdk7.1-sdkreg = "Microsoft SDKs\\Windows\\v7.1\\WinSDKTools" ; # Visual C++ Toolkit 2003 does not store its installation path in the registry. # The environment variable 'VCToolkitInstallDir' and the default installation