From 00c23580afdd519fa716ee32d6dba500e6b1e991 Mon Sep 17 00:00:00 2001 From: Arkadiy Shapkin Date: Sun, 19 Mar 2017 00:59:40 +0800 Subject: [PATCH 1/2] Check Visual Studio 2017+ version in script * Fixed `build.bat` stack overflow on some machines by splitting up to several files * CSharp script simplified and now will check VC++ toolset version --- appveyor.yml | 28 +- src/engine/build.bat | 430 +----------------- src/engine/config_toolset.bat | 238 ++++++++++ src/engine/guess_toolset.bat | 184 ++++++++ src/tools/msvc.jam | 6 +- src/tools/vc141helper/GetCLPath.ps1 | 40 +- .../vc141helper/GetVS2017Configuration.cs | 105 ++--- .../{cl141_path.cmd => cl_path.cmd} | 17 +- 8 files changed, 521 insertions(+), 527 deletions(-) create mode 100644 src/engine/config_toolset.bat create mode 100644 src/engine/guess_toolset.bat rename src/tools/vc141helper/{cl141_path.cmd => cl_path.cmd} (55%) diff --git a/appveyor.yml b/appveyor.yml index 1196a1f0b..d3a8da961 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,26 +2,24 @@ # subject to the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Copyright Rene Rivera 2015-2016. - -build: false +# Copyright Rene Rivera 2015-2017. + image: - - Visual Studio 2013 - - Visual Studio 2015 - Visual Studio 2017 + - Visual Studio 2015 + - Visual Studio 2013 environment: matrix: - - TOOLSET: msvc - TEST_ALL_EXTRAS: + - TEST_ALL_EXTRAS: + +build_script: +- ps: | + & .\bootstrap.bat + if (Test-Path bootstrap.log) { appveyor PushArtifact bootstrap.log } test_script: - - cd src/engine - - build.bat - - cd ../.. - - cd src/tools/vc141helper - - cl141_path.cmd - - cd ../../.. - - ./bootstrap.bat --with-toolset=${TOOLSET} - - cd test && python test_all.py ${TOOLSET} ${TEST_ALL_EXTRAS} +- ps: | + cd test + & python test_all.py msvc $env:TEST_ALL_EXTRAS diff --git a/src/engine/build.bat b/src/engine/build.bat index a4518a764..2d15261ac 100644 --- a/src/engine/build.bat +++ b/src/engine/build.bat @@ -35,18 +35,6 @@ endlocal goto :eof -:Test_Path -REM Tests for the given executable file presence in the directories in the PATH -REM environment variable. Additionaly sets FOUND_PATH to the path of the -REM found file. -call :Clear_Error -setlocal -set test=%~$PATH:1 -endlocal -if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1 -goto :eof - - :Test_Option REM Tests whether the given string is in the form of an option: "--*" call :Clear_Error @@ -85,11 +73,6 @@ endlocal goto :eof -:Call_If_Exists -if EXIST %1 call %* -goto :eof - - :Guess_Toolset REM Try and guess the toolset to bootstrap the build with... REM Sets BOOST_JAM_TOOLSET to the first found toolset. @@ -97,214 +80,29 @@ REM May also set BOOST_JAM_TOOLSET_ROOT to the REM location of the found toolset. call :Clear_Error -call :Test_Empty %ProgramFiles% +call :Test_Empty "%ProgramFiles%" if not errorlevel 1 set "ProgramFiles=C:\Program Files" REM Visual studio is by default installed to %ProgramFiles% on 32-bit machines and REM %ProgramFiles(x86)% on 64-bit machines. Making a common variable for both. call :Clear_Error -call :Test_Empty %ProgramFiles(x86)% +call :Test_Empty "%ProgramFiles(x86)%" if errorlevel 1 ( - set VS_ProgramFiles=%ProgramFiles(x86)% + set "VS_ProgramFiles=%ProgramFiles(x86)%" ) else ( - set VS_ProgramFiles=%ProgramFiles% + set "VS_ProgramFiles=%ProgramFiles%" ) -call :Clear_Error -REM Check the variable first. This can be set manually by the user (by running the tools commmand prompt). -if NOT "_%VS150COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc1410" - set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%" +call guess_toolset.bat +if errorlevel 1 ( + call :Error_Print "Could not find a suitable toolset." goto :eof) -:InvalidComnTools -call :Clear_Error -SET cl141cmd="%~dp0..\tools\vc141helper\cl141_path.cmd" -for /F "tokens=*" %%A IN ('cmd /D /S /C "%cl141cmd% InstallationPath"') DO if NOT "_%%A_" == "__" ( - if errorlevel 1 goto :VCFind_Error - set "BOOST_JAM_TOOLSET=vc1410" - set "BOOST_JAM_TOOLSET_ROOT=%%A\VC\" - goto :eof) -:VCFind_Error -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ( - set "BOOST_JAM_TOOLSET=vc1410" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" ( - set "BOOST_JAM_TOOLSET=vc1410" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" ( - set "BOOST_JAM_TOOLSET=vc1410" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS140COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc14" - set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\VCVARSALL.BAT" ( - set "BOOST_JAM_TOOLSET=vc14" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS120COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc12" - set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\VCVARSALL.BAT" ( - set "BOOST_JAM_TOOLSET=vc12" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS110COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc11" - set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 11.0\VC\VCVARSALL.BAT" ( - set "BOOST_JAM_TOOLSET=vc11" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 11.0\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS100COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc10" - set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" ( - set "BOOST_JAM_TOOLSET=vc10" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 10.0\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS90COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc9" - set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 9.0\VC\VCVARSALL.BAT" ( - set "BOOST_JAM_TOOLSET=vc9" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 9.0\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS80COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc8" - set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 8\VC\VCVARSALL.BAT" ( - set "BOOST_JAM_TOOLSET=vc8" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 8\VC\" - goto :eof) -call :Clear_Error -if NOT "_%VS71COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET=vc7" - set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%\..\..\VC7\" - goto :eof) -call :Clear_Error -if NOT "_%VCINSTALLDIR%_" == "__" ( - REM %VCINSTALLDIR% is also set for VC9 (and probably VC8) - set "BOOST_JAM_TOOLSET=vc7" - set "BOOST_JAM_TOOLSET_ROOT=%VCINSTALLDIR%\VC7\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" ( - set "BOOST_JAM_TOOLSET=vc7" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" ( - set "BOOST_JAM_TOOLSET=vc7" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio .NET\VC7\" - goto :eof) -call :Clear_Error -if NOT "_%MSVCDir%_" == "__" ( - set "BOOST_JAM_TOOLSET=msvc" - set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" ( - set "BOOST_JAM_TOOLSET=msvc" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\VC98\" - goto :eof) -call :Clear_Error -if EXIST "%VS_ProgramFiles%\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" ( - set "BOOST_JAM_TOOLSET=msvc" - set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual C++\VC98\" - goto :eof) -call :Clear_Error -call :Test_Path cl.exe -if not errorlevel 1 ( - set "BOOST_JAM_TOOLSET=msvc" - set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" - goto :eof) -call :Clear_Error -call :Test_Path vcvars32.bat -if not errorlevel 1 ( - set "BOOST_JAM_TOOLSET=msvc" - call "%FOUND_PATH%VCVARS32.BAT" - set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\" - goto :eof) -call :Clear_Error -if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" ( - set "BOOST_JAM_TOOLSET=borland" - set "BOOST_JAM_TOOLSET_ROOT=C:\Borland\BCC55\" - goto :eof) -call :Clear_Error -call :Test_Path bcc32.exe -if not errorlevel 1 ( - set "BOOST_JAM_TOOLSET=borland" - set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" - goto :eof) -call :Clear_Error -call :Test_Path icl.exe -if not errorlevel 1 ( - set "BOOST_JAM_TOOLSET=intel-win32" - set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" - goto :eof) -call :Clear_Error -if EXIST "C:\MinGW\bin\gcc.exe" ( - set "BOOST_JAM_TOOLSET=mingw" - set "BOOST_JAM_TOOLSET_ROOT=C:\MinGW\" - goto :eof) -call :Clear_Error -if NOT "_%CWFolder%_" == "__" ( - set "BOOST_JAM_TOOLSET=metrowerks" - set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\" - goto :eof ) -call :Clear_Error -call :Test_Path mwcc.exe -if not errorlevel 1 ( - set "BOOST_JAM_TOOLSET=metrowerks" - set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\..\" - goto :eof) -call :Clear_Error -call :Error_Print "Could not find a suitable toolset." -goto :eof :Guess_Yacc -REM Tries to find bison or yacc in common places so we can build the grammar. -call :Clear_Error -call :Test_Path yacc.exe -if not errorlevel 1 ( - set "YACC=yacc -d" - goto :eof) -call :Clear_Error -call :Test_Path bison.exe -if not errorlevel 1 ( - set "YACC=bison -d --yacc" - goto :eof) -call :Clear_Error -if EXIST "C:\Program Files\GnuWin32\bin\bison.exe" ( - set "YACC=C:\Program Files\GnuWin32\bin\bison.exe" -d --yacc - goto :eof) -call :Clear_Error -call :Error_Print "Could not find Yacc to build the Jam grammar." +call guess_toolset.bat yacc +if errorlevel 1 ( + call :Error_Print "Could not find Yacc to build the Jam grammar.") goto :eof @@ -356,213 +154,7 @@ if errorlevel 1 ( goto Setup_Args ) :Config_Toolset -if NOT "_%BOOST_JAM_TOOLSET%_" == "_metrowerks_" goto Skip_METROWERKS -if NOT "_%CWFolder%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\" - ) -set "PATH=%BOOST_JAM_TOOLSET_ROOT%Other Metrowerks Tools\Command Line Tools;%PATH%" -set "BOOST_JAM_CC=mwcc -runtime ss -cwd include -DNT -lkernel32.lib -ladvapi32.lib -luser32.lib" -set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" -set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" -set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" -set "_known_=1" -:Skip_METROWERKS -if NOT "_%BOOST_JAM_TOOLSET%_" == "_msvc_" goto Skip_MSVC -if NOT "_%MSVCDir%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\" - ) -call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" -if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) -set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_MSVC -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc7_" goto Skip_VC7 -if NOT "_%VS71COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%..\..\VC7\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC7 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc8_" goto Skip_VC8 -if NOT "_%VS80COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC8 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc9_" goto Skip_VC9 -if NOT "_%VS90COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC9 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc10_" goto Skip_VC10 -if NOT "_%VS100COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC10 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc11_" goto Skip_VC11 -if NOT "_%VS110COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC11 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc12_" goto Skip_VC12 -if NOT "_%VS120COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC12 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc14_" goto Skip_VC14 -if NOT "_%VS140COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\" - ) -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC14 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc1410_" goto Skip_VC1410 -if NOT "_%VS150COMNTOOLS%_" == "__" ( - set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\" - ) - -REM vc1410 vsvarsall requires the architecture as a parameter. -set BOOST_JAM_ARCH=x86 -if NOT "_%PROCESSOR_ARCHITECTURE%_" == "__" set BOOST_JAM_ARCH=%PROCESSOR_ARCHITECTURE% -if NOT "_%Platform%_" == "__" set BOOST_JAM_ARCH=%Platform% -set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %BOOST_JAM_ARCH% - -if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %BOOST_JAM_ARGS% -if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if "_%VCINSTALLDIR%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) ) -set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_VC1410 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_borland_" goto Skip_BORLAND -if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - call :Test_Path bcc32.exe ) -if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - if not errorlevel 1 ( - set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" - ) ) -if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%Bin;%PATH%" - ) -set "BOOST_JAM_CC=bcc32 -WC -w- -q -I%BOOST_JAM_TOOLSET_ROOT%Include -L%BOOST_JAM_TOOLSET_ROOT%Lib /DNT -nbootstrap" -set "BOOST_JAM_OPT_JAM=-ejam0" -set "BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0" -set "BOOST_JAM_OPT_YYACC=-eyyacc0" -set "_known_=1" -:Skip_BORLAND -if NOT "_%BOOST_JAM_TOOLSET%_" == "_como_" goto Skip_COMO -set "BOOST_JAM_CC=como -DNT" -set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" -set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" -set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" -set "_known_=1" -:Skip_COMO -if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc_" goto Skip_GCC -set "BOOST_JAM_CC=gcc -DNT" -set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" -set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" -set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" -set "_known_=1" -:Skip_GCC -if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc-nocygwin_" goto Skip_GCC_NOCYGWIN -set "BOOST_JAM_CC=gcc -DNT -mno-cygwin" -set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" -set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" -set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" -set "_known_=1" -:Skip_GCC_NOCYGWIN -if NOT "_%BOOST_JAM_TOOLSET%_" == "_intel-win32_" goto Skip_INTEL_WIN32 -set "BOOST_JAM_CC=icl -DNT /nologo kernel32.lib advapi32.lib user32.lib" -set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" -set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" -set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" -set "_known_=1" -:Skip_INTEL_WIN32 -if NOT "_%BOOST_JAM_TOOLSET%_" == "_mingw_" goto Skip_MINGW -if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( - set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" - ) -set "BOOST_JAM_CC=gcc -DNT" -set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" -set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" -set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" -set "_known_=1" -:Skip_MINGW -call :Clear_Error +call config_toolset.bat if "_%_known_%_" == "__" ( call :Error_Print "Unknown toolset: %BOOST_JAM_TOOLSET%" ) diff --git a/src/engine/config_toolset.bat b/src/engine/config_toolset.bat new file mode 100644 index 000000000..7811923d8 --- /dev/null +++ b/src/engine/config_toolset.bat @@ -0,0 +1,238 @@ +@ECHO OFF + +REM ~ Copyright 2002-2007 Rene Rivera. +REM ~ Distributed under the Boost Software License, Version 1.0. +REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +goto Start + + +:Call_If_Exists +if EXIST %1 call %* +goto :eof + + +:Start +REM Setup the toolset command and options. This bit of code +REM needs to be flexible enough to handle both when +REM the toolset was guessed at and found, or when the toolset +REM was indicated in the command arguments. +REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way +REM because in BAT variables are subsituted only once during a single +REM command. A complete "if ... else ..." +REM is a single command, even though it's in multiple lines here. +if NOT "_%BOOST_JAM_TOOLSET%_" == "_metrowerks_" goto Skip_METROWERKS +if NOT "_%CWFolder%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\" + ) +set "PATH=%BOOST_JAM_TOOLSET_ROOT%Other Metrowerks Tools\Command Line Tools;%PATH%" +set "BOOST_JAM_CC=mwcc -runtime ss -cwd include -DNT -lkernel32.lib -ladvapi32.lib -luser32.lib" +set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" +set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" +set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" +set "_known_=1" +:Skip_METROWERKS +if NOT "_%BOOST_JAM_TOOLSET%_" == "_msvc_" goto Skip_MSVC +if NOT "_%MSVCDir%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\" + ) +call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" +if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) +set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_MSVC +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc7_" goto Skip_VC7 +if NOT "_%VS71COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%..\..\VC7\" + ) +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC7 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc8_" goto Skip_VC8 +if NOT "_%VS80COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\" + ) +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC8 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc9_" goto Skip_VC9 +if NOT "_%VS90COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\" + ) +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC9 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc10_" goto Skip_VC10 +if NOT "_%VS100COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\" + ) +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC10 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc11_" goto Skip_VC11 +if NOT "_%VS110COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\" + ) +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC11 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc12_" goto Skip_VC12 +if NOT "_%VS120COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\" + ) + +if "_%BOOST_JAM_ARCH%_" == "__" set BOOST_JAM_ARCH=x86 +set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %BOOST_JAM_ARCH% + +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC12 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc14_" goto Skip_VC14 +if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if NOT "_%VS140COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\" + )) + +if "_%BOOST_JAM_ARCH%_" == "__" set BOOST_JAM_ARCH=x86 +set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %BOOST_JAM_ARCH% + +if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS% +if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if "_%VCINSTALLDIR%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) ) +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC14 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc1410_" goto Skip_VC1410 +if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if NOT "_%VS150COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\" + )) +SET cl_path_cmd="%~dp0..\tools\vc141helper\cl_path.cmd" +if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + for /f "tokens=*" %%A in ('cmd /D /S /C "%cl_path_cmd% 14.10"') do if NOT errorlevel 1 if NOT "_%%A_" == "__" ( + set "BOOST_JAM_TOOLSET_ROOT=%%A\VC\")) + +REM vc1410 vsvarsall requires the architecture as a parameter. +if "_%BOOST_JAM_ARCH%_" == "__" set BOOST_JAM_ARCH=x86 +set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %BOOST_JAM_ARCH% + +if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %BOOST_JAM_ARGS% +set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_VC1410 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_borland_" goto Skip_BORLAND +if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + call :Test_Path bcc32.exe ) +if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + if not errorlevel 1 ( + set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" + ) ) +if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%Bin;%PATH%" + ) +set "BOOST_JAM_CC=bcc32 -WC -w- -q -I%BOOST_JAM_TOOLSET_ROOT%Include -L%BOOST_JAM_TOOLSET_ROOT%Lib /DNT -nbootstrap" +set "BOOST_JAM_OPT_JAM=-ejam0" +set "BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0" +set "BOOST_JAM_OPT_YYACC=-eyyacc0" +set "_known_=1" +:Skip_BORLAND +if NOT "_%BOOST_JAM_TOOLSET%_" == "_como_" goto Skip_COMO +set "BOOST_JAM_CC=como -DNT" +set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" +set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" +set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" +set "_known_=1" +:Skip_COMO +if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc_" goto Skip_GCC +set "BOOST_JAM_CC=gcc -DNT" +set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" +set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" +set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" +set "_known_=1" +:Skip_GCC +if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc-nocygwin_" goto Skip_GCC_NOCYGWIN +set "BOOST_JAM_CC=gcc -DNT -mno-cygwin" +set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" +set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" +set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" +set "_known_=1" +:Skip_GCC_NOCYGWIN +if NOT "_%BOOST_JAM_TOOLSET%_" == "_intel-win32_" goto Skip_INTEL_WIN32 +set "BOOST_JAM_CC=icl -DNT /nologo kernel32.lib advapi32.lib user32.lib" +set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0" +set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0" +set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0" +set "_known_=1" +:Skip_INTEL_WIN32 +if NOT "_%BOOST_JAM_TOOLSET%_" == "_mingw_" goto Skip_MINGW +if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" ( + set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%" + ) +set "BOOST_JAM_CC=gcc -DNT" +set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe" +set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe" +set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe" +set "_known_=1" +:Skip_MINGW +exit /b %errorlevel% diff --git a/src/engine/guess_toolset.bat b/src/engine/guess_toolset.bat new file mode 100644 index 000000000..129ea4293 --- /dev/null +++ b/src/engine/guess_toolset.bat @@ -0,0 +1,184 @@ +@ECHO OFF + +REM ~ Copyright 2002-2007 Rene Rivera. +REM ~ Distributed under the Boost Software License, Version 1.0. +REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +if "_%1_" == "_yacc_" goto Guess_Yacc +goto Guess + + +:Clear_Error +ver >nul +goto :eof + + +:Test_Path +REM Tests for the given executable file presence in the directories in the PATH +REM environment variable. Additionaly sets FOUND_PATH to the path of the +REM found file. +call :Clear_Error +setlocal +set test=%~$PATH:1 +endlocal +if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1 +goto :eof + + +:Guess +REM Check the variable first. This can be set manually by the user (by running the tools commmand prompt). +call :Clear_Error +if NOT "_%VS150COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc1410" + set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\" + goto :eof) +SET cl_path_cmd="%~dp0..\tools\vc141helper\cl_path.cmd" +for /f "tokens=*" %%A in ('cmd /D /S /C "%cl_path_cmd% 14.10"') do if NOT errorlevel 1 if NOT "_%%A_" == "__" ( + set "BOOST_JAM_TOOLSET=vc1410" + set "BOOST_JAM_TOOLSET_ROOT=%%A\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ( + set "BOOST_JAM_TOOLSET=vc1410" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" ( + set "BOOST_JAM_TOOLSET=vc1410" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" ( + set "BOOST_JAM_TOOLSET=vc1410" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\" + goto :eof) +if NOT "_%VS140COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc14" + set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\VCVARSALL.BAT" ( + set "BOOST_JAM_TOOLSET=vc14" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\" + goto :eof) +if NOT "_%VS120COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc12" + set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\VCVARSALL.BAT" ( + set "BOOST_JAM_TOOLSET=vc12" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\" + goto :eof) +if NOT "_%VS110COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc11" + set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 11.0\VC\VCVARSALL.BAT" ( + set "BOOST_JAM_TOOLSET=vc11" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 11.0\VC\" + goto :eof) +if NOT "_%VS100COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc10" + set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" ( + set "BOOST_JAM_TOOLSET=vc10" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 10.0\VC\" + goto :eof) +if NOT "_%VS90COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc9" + set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 9.0\VC\VCVARSALL.BAT" ( + set "BOOST_JAM_TOOLSET=vc9" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 9.0\VC\" + goto :eof) +if NOT "_%VS80COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc8" + set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 8\VC\VCVARSALL.BAT" ( + set "BOOST_JAM_TOOLSET=vc8" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 8\VC\" + goto :eof) +if NOT "_%VS71COMNTOOLS%_" == "__" ( + set "BOOST_JAM_TOOLSET=vc7" + set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%\..\..\VC7\" + goto :eof) +if NOT "_%VCINSTALLDIR%_" == "__" ( + REM %VCINSTALLDIR% is also set for VC9 (and probably VC8) + set "BOOST_JAM_TOOLSET=vc7" + set "BOOST_JAM_TOOLSET_ROOT=%VCINSTALLDIR%\VC7\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" ( + set "BOOST_JAM_TOOLSET=vc7" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" ( + set "BOOST_JAM_TOOLSET=vc7" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio .NET\VC7\" + goto :eof) +if NOT "_%MSVCDir%_" == "__" ( + set "BOOST_JAM_TOOLSET=msvc" + set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" ( + set "BOOST_JAM_TOOLSET=msvc" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\VC98\" + goto :eof) +if EXIST "%VS_ProgramFiles%\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" ( + set "BOOST_JAM_TOOLSET=msvc" + set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual C++\VC98\" + goto :eof) +call :Test_Path cl.exe +if not errorlevel 1 ( + set "BOOST_JAM_TOOLSET=msvc" + set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" + goto :eof) +call :Test_Path vcvars32.bat +if not errorlevel 1 ( + set "BOOST_JAM_TOOLSET=msvc" + call "%FOUND_PATH%VCVARS32.BAT" + set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\" + goto :eof) +if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" ( + set "BOOST_JAM_TOOLSET=borland" + set "BOOST_JAM_TOOLSET_ROOT=C:\Borland\BCC55\" + goto :eof) +call :Test_Path bcc32.exe +if not errorlevel 1 ( + set "BOOST_JAM_TOOLSET=borland" + set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" + goto :eof) +call :Test_Path icl.exe +if not errorlevel 1 ( + set "BOOST_JAM_TOOLSET=intel-win32" + set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\" + goto :eof) +if EXIST "C:\MinGW\bin\gcc.exe" ( + set "BOOST_JAM_TOOLSET=mingw" + set "BOOST_JAM_TOOLSET_ROOT=C:\MinGW\" + goto :eof) +if NOT "_%CWFolder%_" == "__" ( + set "BOOST_JAM_TOOLSET=metrowerks" + set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\" + goto :eof) +call :Test_Path mwcc.exe +if not errorlevel 1 ( + set "BOOST_JAM_TOOLSET=metrowerks" + set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\..\" + goto :eof) +REM Could not find a suitable toolset +exit /b 1 + + +:Guess_Yacc +REM Tries to find bison or yacc in common places so we can build the grammar. +call :Test_Path yacc.exe +if not errorlevel 1 ( + set "YACC=yacc -d" + goto :eof) +call :Test_Path bison.exe +if not errorlevel 1 ( + set "YACC=bison -d --yacc" + goto :eof) +if EXIST "C:\Program Files\GnuWin32\bin\bison.exe" ( + set "YACC=C:\Program Files\GnuWin32\bin\bison.exe" -d --yacc + goto :eof) +exit /b 1 diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 81f2ef8a8..bed737b98 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -711,8 +711,8 @@ local rule auto-detect-toolset-versions ( ) if $(i) = 14.10 { local file = [ path.make [ modules.binding $(__name__) ] ] ; - local cl141_path = [ path.native [ path.join [ path.parent $(file) ] vc141helper cl141_path.cmd ] ] ; - local shell_ret = [ SHELL $(cl141_path) ] ; + local cl_path = [ path.native [ path.join [ path.parent $(file) ] vc141helper cl_path.cmd ] ] ; + local shell_ret = [ SHELL "$(cl_path) 14.10 -PathToCompiler" ] ; local cl_path = $(shell_ret:D) ; if $(cl_path) { @@ -1635,7 +1635,7 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] .version-alias-11 = 11.0 ; .version-alias-12 = 12.0 ; .version-alias-14 = 14.0 ; -.version-alias-15 = 14.10 ; +.version-alias-14.1 = 14.10 ; # Names of registry keys containing the Visual C++ installation path (relative # to "HKEY_LOCAL_MACHINE\SOFTWARE\\Microsoft"). diff --git a/src/tools/vc141helper/GetCLPath.ps1 b/src/tools/vc141helper/GetCLPath.ps1 index ccef0da9a..0c09fd028 100644 --- a/src/tools/vc141helper/GetCLPath.ps1 +++ b/src/tools/vc141helper/GetCLPath.ps1 @@ -1,14 +1,36 @@ # Copyright 2017 - Refael Ackermann +# Copyright 2017 - Arkady Shapkin # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) + +Param( + [Parameter(Mandatory=$True,Position=1)] + [string]$toolsetVersion, + [switch]$pathToCompiler = $false +) + +# Is Microsoft.VisualStudio.Setup.Configuration.Native.dll installed if (-NOT (Test-Path 'Registry::HKEY_CLASSES_ROOT\CLSID\{177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D}')) { Exit 1 } -$jsonFile = '.tmp.json' -Invoke-Expression 'powershell -NoProfile -ExecutionPolicy Unrestricted -Command "&{ Add-Type -Path GetVS2017Configuration.cs; [VisualStudioConfiguration.Main]::Query()}"' > $jsonFile -$instPath = (Get-Content $jsonFile | ? {$_ -like "*InstallationPath*"}) -split '"' -replace '\\\\', '\' | Select-Object -skip 3 -first 1 -Remove-Item $jsonFile -if ($args[0] -eq 'InstallationPath') { echo $instPath; exit } -if ($env:PROCESSOR_ARCHITEW6432 -ne $null) {$filt = '*64\x64*'} else {$filt = '*86\x86*'} -$cls = get-childitem $instPath -Include cl.exe -Recurse | ? { $_.Directory -like '*Host*' } -$cl = $cls | ? { $_.Directory -like $filt } -if ($cl -ne $null) {echo $cl.FullName} else {echo $cls[0].FullName} + +Add-Type -Path (Join-Path $PSScriptRoot GetVS2017Configuration.cs) | Out-Null +$instPath = [VisualStudioConfiguration.Main]::Query($toolsetVersion) + +if ($pathToCompiler) +{ + if ($env:PROCESSOR_ARCHITEW6432 -ne $null) {$filt = '*64\x64*'} else {$filt = '*86\x86*'} + $cls = get-childitem $instPath -Include cl.exe -Recurse | ? { $_.Directory -like '*Host*' } + $cl = $cls | ? { $_.Directory -like $filt } + if ($cl -ne $null) + { + Write-Output $cl.FullName + } + else + { + Write-Output $cls[0].FullName + } +} +else +{ + Write-Output $instPath +} diff --git a/src/tools/vc141helper/GetVS2017Configuration.cs b/src/tools/vc141helper/GetVS2017Configuration.cs index ee26c65c3..749369cd9 100644 --- a/src/tools/vc141helper/GetVS2017Configuration.cs +++ b/src/tools/vc141helper/GetVS2017Configuration.cs @@ -1,14 +1,17 @@ // Copyright 2017 - Refael Ackermann +// Copyright 2017 - Arkady Shapkin // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) using System; using System.Collections.Generic; +using System.Linq; using System.Runtime.InteropServices; namespace VisualStudioConfiguration { +#region VS setup COM types [Flags] public enum InstanceState : uint { @@ -180,88 +183,52 @@ namespace VisualStudioConfiguration public class SetupConfigurationClass { } +#endregion public static class Main { - - public static void Echo(string tmplt, params Object[] args) + public static string Query(string vcToolVersion) { - string str = (args.Length > 0) ? String.Format(tmplt, args) : tmplt; - Console.Write(" " + str + '\n'); - } - - public static void Query() - { - ISetupConfiguration query = new SetupConfiguration(); - ISetupConfiguration2 query2 = (ISetupConfiguration2) query; - IEnumSetupInstances e = query2.EnumAllInstances(); - ISetupInstance2[] rgelt = new ISetupInstance2[1]; - int pceltFetched; - Echo("["); + ISetupConfiguration query = new SetupConfiguration(); + ISetupConfiguration2 query2 = (ISetupConfiguration2)query; + IEnumSetupInstances e = query2.EnumAllInstances(); + ISetupInstance2[] rgelt = new ISetupInstance2[1]; + int pceltFetched; e.Next(1, rgelt, out pceltFetched); - while (pceltFetched > 0) - { - PrintInstance(rgelt[0]); + var instances = new List>(); + while (pceltFetched > 0) + { + var inst = CheckVsInstance(rgelt[0], vcToolVersion); + if (inst != null) + instances.Add(inst.Value); e.Next(1, rgelt, out pceltFetched); - if (pceltFetched > 0) - Echo(","); - } - Echo("]"); + } + + // find latest VC++ compiler for given version + var latestInst = instances.OrderByDescending(i => i.Key).FirstOrDefault(); + return latestInst.Value; } - private static void PrintInstance(ISetupInstance2 setupInstance2) + private static KeyValuePair? CheckVsInstance(ISetupInstance2 setupInstance2, string vcToolVersion) { - Echo("{"); - string[] prodParts = setupInstance2.GetProduct().GetId().Split('.'); - Array.Reverse(prodParts); - string prod = prodParts[0]; - string instPath = setupInstance2.GetInstallationPath().Replace("\\", "\\\\"); - string installationVersion = setupInstance2.GetInstallationVersion(); bool isComplete = setupInstance2.IsComplete(); bool isLaunchable = setupInstance2.IsLaunchable(); - Echo("\"Product\": \"{0}\",", prod); - Echo("\"Version\": \"{0}\",", installationVersion); - Echo("\"InstallationPath\": \"{0}\",", instPath); - Echo("\"IsComplete\": \"{0}\",", isComplete ? "true" : "false"); - Echo("\"IsLaunchable\": \"{0}\",", isLaunchable ? "true" : "false"); - String cmd = (instPath + "\\\\Common7\\\\Tools\\\\VsDevCmd.bat"); - Echo("\"CmdPath\": \"{0}\",", cmd); + if (isComplete && isLaunchable) + return null; + InstanceState state = setupInstance2.GetState(); + if ((state & InstanceState.Local) != InstanceState.Local) + return null; - List packs = new List(); - string MSBuild = "false"; - string VCTools = "false"; - string Win8SDK = "0"; - string sdk10Ver = "0"; - foreach (ISetupPackageReference package in setupInstance2.GetPackages()) - { - string id = package.GetId(); - string ver = package.GetVersion(); - string detail = "{\"id\": \"" + id + "\", \"version\":\"" + ver + "\"}"; - packs.Add(" " + detail); + var vctools = setupInstance2.GetPackages() + .FirstOrDefault(item => item.GetId() == "Microsoft.VisualCpp.Tools.Core"); + if (vctools == null) + return null; + string version = vctools.GetVersion(); + if (!version.StartsWith(vcToolVersion + ".")) + return null; - if (id.Contains("Component.MSBuild")) { - MSBuild = detail; - } else if (id.Contains("VC.Tools")) { - VCTools = detail; - } else if (id.Contains("Microsoft.Windows.81SDK")) { - if (Win8SDK.CompareTo(ver) > 0) continue; - Win8SDK = ver; - } else if (id.Contains("Win10SDK_10")) { - if (sdk10Ver.CompareTo(ver) > 0) continue; - sdk10Ver = ver; - } - } - packs.Sort(); - string[] sdk10Parts = sdk10Ver.Split('.'); - sdk10Parts[sdk10Parts.Length - 1] = "0"; - Echo("\"MSBuild\": {0},", MSBuild); - Echo("\"VCTools\": {0},", VCTools); - Echo("\"SDK8\": \"{0}\",", Win8SDK); - Echo("\"SDK10\": \"{0}\",", sdk10Ver); - Echo("\"SDK\": \"{0}\",", String.Join(".", sdk10Parts)); - Echo("\"Packages\": [\n {0} \n ]", String.Join(",\n ", packs.ToArray())); - Echo("}"); + string instPath = setupInstance2.GetInstallationPath(); + return new KeyValuePair(new Version(version), instPath); } } - } diff --git a/src/tools/vc141helper/cl141_path.cmd b/src/tools/vc141helper/cl_path.cmd similarity index 55% rename from src/tools/vc141helper/cl141_path.cmd rename to src/tools/vc141helper/cl_path.cmd index 29761347c..92e301fa3 100644 --- a/src/tools/vc141helper/cl141_path.cmd +++ b/src/tools/vc141helper/cl_path.cmd @@ -1,16 +1,9 @@ :: Copyright 2017 - Refael Ackermann +:: Copyright 2017 - Arkady Shapkin :: Distributed under the Boost Software License, Version 1.0. :: (See accompanying file LICENSE_1_0.txt or copy at :: http://www.boost.org/LICENSE_1_0.txt) -@IF NOT DEFINED DEBUG_GETTER @ECHO OFF -SETLOCAL -PUSHD %~dp0 -SET PROMPT=$G -SET DEBUG_GETTER= -CALL :find_CL %~dp0 %1 -POPD -GOTO :eof - -:find_CL -FOR /F "tokens=*" %%A IN ('powershell -NoProfile -ExecutionPolicy Unrestricted "%1GetCLPath.ps1" %2') DO ECHO %%A& EXIT /B -GOTO :eof \ No newline at end of file +@ECHO OFF +FOR /F "tokens=*" %%A IN ('powershell -NoProfile -ExecutionPolicy Bypass "%~dp0GetCLPath.ps1" %1 %2') DO ( + ECHO %%A +) \ No newline at end of file From 2c46d2553655faac9387fec0fd77865979eeeef5 Mon Sep 17 00:00:00 2001 From: Arkadiy Shapkin Date: Sun, 19 Mar 2017 11:39:55 +0800 Subject: [PATCH 2/2] "core-language" test fixed for Windows 10 --- appveyor.yml | 16 ++++++++++++++-- test/core-language/test.jam | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d3a8da961..775874e42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,9 +17,21 @@ environment: build_script: - ps: | & .\bootstrap.bat - if (Test-Path bootstrap.log) { appveyor PushArtifact bootstrap.log } + $BootstrapExitCode = $LastExitCode + if (Test-Path bootstrap.log) + { + Push-AppveyorArtifact bootstrap.log + } + if ($BootstrapExitCode -ne 0) { $host.SetShouldExit($BootstrapExitCode) } test_script: - ps: | cd test - & python test_all.py msvc $env:TEST_ALL_EXTRAS + & python test_all.py msvc $env:TEST_ALL_EXTRAS --preserve + $TestExitCode = $LastExitCode + if (Test-Path failed_test) + { + & 7z a failed_test.zip failed_test\* + Push-AppveyorArtifact failed_test.zip + } + if ($TestExitCode -ne 0) { $host.SetShouldExit($TestExitCode) } diff --git a/test/core-language/test.jam b/test/core-language/test.jam index b0ac767ef..341efcf80 100644 --- a/test/core-language/test.jam +++ b/test/core-language/test.jam @@ -1471,7 +1471,7 @@ if $(NT) for local x in $(param:L) { if ! x in $(found) && - $(x) in "addservices" "policies" "deleted device ids" + $(x) in "addservices" "policies" "deleted device ids" "software" { found += $(x) ; }