From aaf14325ec8e3ca86be9afaa501bca68fcfea8b3 Mon Sep 17 00:00:00 2001 From: Sergei Krivonos Date: Thu, 30 Sep 2021 18:59:15 +0300 Subject: [PATCH] Add VC143, aka VS2012, aka cl.exe 17.x toolset. Adds the vc143 preview toolset to bootstrap and build. Note, vc142 is still the default msvc toolset. When vc143 is released it will become the default with a future change. --- src/engine/build.bat | 2 +- src/engine/config_toolset.bat | 23 ++++++++++++++++++ src/engine/guess_toolset.bat | 4 +++ src/engine/vswhere_usability_wrapper.cmd | 17 +++++++++++-- src/tools/msvc.jam | 31 ++++++++++++++++++++---- 5 files changed, 69 insertions(+), 8 deletions(-) diff --git a/src/engine/build.bat b/src/engine/build.bat index 59b30cfde..09a62e5d5 100644 --- a/src/engine/build.bat +++ b/src/engine/build.bat @@ -29,7 +29,7 @@ ECHO ### .\build.bat msvc ECHO ### ECHO ### Toolsets supported by this script are: borland, como, gcc, ECHO ### gcc-nocygwin, intel-win32, mingw, -ECHO ### vc12, vc14, vc141, vc142 +ECHO ### vc12, vc14, vc141, vc142, vc143 ECHO ### ECHO ### If you have Visual Studio 2017 installed you will need to either update ECHO ### the Visual Studio 2017 installer or run from VS 2017 Command Prompt diff --git a/src/engine/config_toolset.bat b/src/engine/config_toolset.bat index 6c9daf11e..a9886f4e9 100644 --- a/src/engine/config_toolset.bat +++ b/src/engine/config_toolset.bat @@ -11,6 +11,7 @@ if "_%B2_TOOLSET%_" == "_vc12_" call :Config_VC12 if "_%B2_TOOLSET%_" == "_vc14_" call :Config_VC14 if "_%B2_TOOLSET%_" == "_vc141_" call :Config_VC141 if "_%B2_TOOLSET%_" == "_vc142_" call :Config_VC142 +if "_%B2_TOOLSET%_" == "_vc143_" call :Config_VC143 if "_%B2_TOOLSET%_" == "_borland_" call :Config_BORLAND if "_%B2_TOOLSET%_" == "_como_" call :Config_COMO if "_%B2_TOOLSET%_" == "_gcc_" call :Config_GCC @@ -137,6 +138,28 @@ set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof +:Config_VC143 +if not defined CXX ( set "CXX=cl" ) +call vswhere_usability_wrapper.cmd +REM Reset ERRORLEVEL since from now on it's all based on ENV vars +ver > nul 2> nul +if "_%B2_TOOLSET_ROOT%_" == "__" ( + if NOT "_%VS170COMNTOOLS%_" == "__" ( + set "B2_TOOLSET_ROOT=%VS170COMNTOOLS%..\..\VC\" + )) + +if "_%B2_ARCH%_" == "__" set B2_ARCH=%PROCESSOR_ARCHITECTURE% +set B2_BUILD_ARGS=%B2_BUILD_ARGS% %B2_ARCH% + +REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\Source if it exists. +pushd %CD% +if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS% +popd +set "B2_CXX="%CXX%" /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL /EHsc" +set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" +set "_known_=1" +goto :eof + :Config_VCUNK if NOT "_%B2_TOOLSET%_" == "_vcunk_" goto Skip_VCUNK call vswhere_usability_wrapper.cmd diff --git a/src/engine/guess_toolset.bat b/src/engine/guess_toolset.bat index 709332711..6b3c6094e 100644 --- a/src/engine/guess_toolset.bat +++ b/src/engine/guess_toolset.bat @@ -33,6 +33,10 @@ REM Let vswhere tell us where msvc is at, if available. call :Clear_Error call vswhere_usability_wrapper.cmd call :Clear_Error +if NOT "_%VS170COMNTOOLS%_" == "__" ( + set "B2_TOOLSET=vc143" + set "B2_TOOLSET_ROOT=%VS170COMNTOOLS%..\..\VC\" + goto :eof) if NOT "_%VS160COMNTOOLS%_" == "__" ( set "B2_TOOLSET=vc142" set "B2_TOOLSET_ROOT=%VS160COMNTOOLS%..\..\VC\" diff --git a/src/engine/vswhere_usability_wrapper.cmd b/src/engine/vswhere_usability_wrapper.cmd index b9d917231..8759a6ac5 100644 --- a/src/engine/vswhere_usability_wrapper.cmd +++ b/src/engine/vswhere_usability_wrapper.cmd @@ -17,8 +17,8 @@ if errorlevel 1 goto :no-vswhere set VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 set VSWHERE_PRP=-property installationPath -REM Visual Studio Unknown Version, Beyond 2019 -set VSWHERE_LMT=-version "[17.0,18.0)" +REM Visual Studio Unknown Version, Beyond 2022 +set VSWHERE_LMT=-version "[18.0,19.0)" set VSWHERE_PRERELEASE=-prerelease SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT% %VSWHERE_PRERELEASE% for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do ( @@ -30,6 +30,19 @@ for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do ( exit /B 0 ) +REM Visual Studio 2022 +set VSWHERE_LMT=-version "[17.0,18.0)" +set VSWHERE_PRERELEASE=-prerelease +SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT% %VSWHERE_PRERELEASE% +for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do ( + endlocal + echo Found with vswhere %%i + @rem comment out setting VCINSTALLDIR for Boost.build + @rem set "VCINSTALLDIR=%%i\VC\" + set "VS170COMNTOOLS=%%i\Common7\Tools\" + exit /B 0 +) + REM Visual Studio 2019 (16.X, toolset 14.2) set VSWHERE_LMT=-version "[16.0,17.0)" SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT% %VSWHERE_PRERELEASE% diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index fa737b67d..5129b6fd0 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -1113,7 +1113,15 @@ local rule generate-setup-cmd ( version : command : parent : options * : cpu : g } else { - if [ MATCH "(14.2)" : $(version) ] + if [ MATCH "(14.3)" : $(version) ] + { + if $(.debug-configuration) + { + ECHO "notice: [generate-setup-cmd] $(version) is 14.3" ; + } + parent = [ path.native [ path.join $(parent) "..\\..\\..\\..\\..\\Auxiliary\\Build" ] ] ; + } + else if [ MATCH "(14.2)" : $(version) ] { if $(.debug-configuration) { @@ -1284,7 +1292,11 @@ local rule configure-really ( version ? : options * ) # version from the path. # FIXME: We currently detect both Microsoft Visual Studio 9.0 and # 9.0express as 9.0 here. - if [ MATCH "(MSVC\\\\14.2)" : $(command) ] + if [ MATCH "(MSVC\\\\14.3)" : $(command) ] + { + version = 14.3 ; + } + else if [ MATCH "(MSVC\\\\14.2)" : $(command) ] { version = 14.2 ; } @@ -1701,13 +1713,17 @@ local rule default-path ( version ) # And fortunately, forward slashes do also work in native Windows. local vswhere = "$(root)/Microsoft Visual Studio/Installer/vswhere.exe" ; # The check for $(root) is to avoid a segmentation fault if not found. - if $(version) in 14.1 14.2 default && $(root) && [ path.exists $(vswhere) ] + if $(version) in 14.1 14.2 14.3 default && $(root) && [ path.exists $(vswhere) ] { local req = "-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64" ; local prop = "-property installationPath" ; local limit ; - if $(version) = 14.2 || $(version) = "default" + if $(version) = 14.3 + { + limit = "-version \"[17.0,18.0)\" -prerelease" ; + } + else if $(version) = 14.2 || $(version) = "default" { limit = "-version \"[16.0,17.0)\"" ; } @@ -2138,7 +2154,7 @@ for local arch in [ MATCH "^\\.cpus-on-(.*)" : [ VARNAMES $(__name__) ] ] armv7 armv7s ; # Known toolset versions, in order of preference. -.known-versions = 14.2 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1 +.known-versions = 14.3 14.2 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1 7.1toolkit 7.0 6.0 ; # Version aliases. @@ -2185,6 +2201,11 @@ for local arch in [ MATCH "^\\.cpus-on-(.*)" : [ VARNAMES $(__name__) ] ] "Microsoft Visual Studio/2019/*/VC/Tools/MSVC/*/bin/Host*/*" ; .version-14.2-env = VS160COMNTOOLS ProgramFiles ProgramFiles(x86) ; +.version-14.3-path = + "../../VC/Tools/MSVC/*/bin/Host*/*" + "Microsoft Visual Studio/2022/*/VC/Tools/MSVC/*/bin/Host*/*" + ; +.version-14.3-env = VS170COMNTOOLS ProgramFiles ProgramFiles(x86) ; # Auto-detect all the available msvc installations on the system. auto-detect-toolset-versions ;