1@ECHO OFF
2
3REM ~ Copyright 2002-2018 Rene Rivera.
4REM ~ Distributed under the Boost Software License, Version 1.0.
5REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7:Start
8REM Setup the toolset command and options.
9if "_%B2_TOOLSET%_" == "_msvc_" call :Config_MSVC
10if "_%B2_TOOLSET%_" == "_vc11_" call :Config_VC11
11if "_%B2_TOOLSET%_" == "_vc12_" call :Config_VC12
12if "_%B2_TOOLSET%_" == "_vc14_" call :Config_VC14
13if "_%B2_TOOLSET%_" == "_vc141_" call :Config_VC141
14if "_%B2_TOOLSET%_" == "_vc142_" call :Config_VC142
15if "_%B2_TOOLSET%_" == "_borland_" call :Config_BORLAND
16if "_%B2_TOOLSET%_" == "_como_" call :Config_COMO
17if "_%B2_TOOLSET%_" == "_gcc_" call :Config_GCC
18if "_%B2_TOOLSET%_" == "_gcc-nocygwin_" call :Config_GCC_NOCYGWIN
19if "_%B2_TOOLSET%_" == "_intel-win32_" call :Config_INTEL_WIN32
20if "_%B2_TOOLSET%_" == "_mingw_" call :Config_MINGW
21exit /b %errorlevel%
22
23:Call_If_Exists
24ECHO Call_If_Exists %*
25if EXIST %1 call %*
26goto :eof
27
28:Config_MSVC
29if not defined CXX ( set "CXX=cl" )
30if NOT "_%MSVCDir%_" == "__" (
31    set "B2_TOOLSET_ROOT=%MSVCDir%\"
32    )
33call :Call_If_Exists "%B2_TOOLSET_ROOT%bin\VCVARS32.BAT"
34if not "_%B2_TOOLSET_ROOT%_" == "__" (
35    set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%"
36    )
37set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
38set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
39set "_known_=1"
40goto :eof
41
42:Config_VC11
43if not defined CXX ( set "CXX=cl" )
44if NOT "_%VS110COMNTOOLS%_" == "__" (
45    set "B2_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\"
46    )
47if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%VCVARSALL.BAT" %B2_BUILD_ARGS%
48if NOT "_%B2_TOOLSET_ROOT%_" == "__" (
49    if "_%VCINSTALLDIR%_" == "__" (
50        set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%"
51        ) )
52set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
53set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
54set "_known_=1"
55goto :eof
56
57:Config_VC12
58if not defined CXX ( set "CXX=cl" )
59if NOT "_%VS120COMNTOOLS%_" == "__" (
60    set "B2_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\"
61    )
62
63if "_%B2_ARCH%_" == "__" set B2_ARCH=x86
64set B2_BUILD_ARGS=%B2_BUILD_ARGS% %B2_ARCH%
65
66if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%VCVARSALL.BAT" %B2_BUILD_ARGS%
67if NOT "_%B2_TOOLSET_ROOT%_" == "__" (
68    if "_%VCINSTALLDIR%_" == "__" (
69        set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%"
70        ) )
71set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
72set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
73set "_known_=1"
74goto :eof
75
76:Config_VC14
77if not defined CXX ( set "CXX=cl" )
78if "_%B2_TOOLSET_ROOT%_" == "__" (
79    if NOT "_%VS140COMNTOOLS%_" == "__" (
80        set "B2_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\"
81    ))
82
83if "_%B2_ARCH%_" == "__" set B2_ARCH=x86
84set B2_BUILD_ARGS=%B2_BUILD_ARGS% %B2_ARCH%
85
86if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%VCVARSALL.BAT" %B2_BUILD_ARGS%
87if NOT "_%B2_TOOLSET_ROOT%_" == "__" (
88    if "_%VCINSTALLDIR%_" == "__" (
89        set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%"
90        ) )
91set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
92set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
93set "_known_=1"
94goto :eof
95
96:Config_VC141
97if not defined CXX ( set "CXX=cl" )
98call vswhere_usability_wrapper.cmd
99REM Reset ERRORLEVEL since from now on it's all based on ENV vars
100ver > nul 2> nul
101if "_%B2_TOOLSET_ROOT%_" == "__" (
102    if NOT "_%VS150COMNTOOLS%_" == "__" (
103        set "B2_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\"
104    ))
105
106if "_%B2_ARCH%_" == "__" set B2_ARCH=x86
107set B2_BUILD_ARGS=%B2_BUILD_ARGS% %B2_ARCH%
108
109REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\Source if it exists.
110pushd %CD%
111if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS%
112popd
113set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
114set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
115set "_known_=1"
116goto :eof
117
118:Config_VC142
119if not defined CXX ( set "CXX=cl" )
120call vswhere_usability_wrapper.cmd
121REM Reset ERRORLEVEL since from now on it's all based on ENV vars
122ver > nul 2> nul
123if "_%B2_TOOLSET_ROOT%_" == "__" (
124    if NOT "_%VS160COMNTOOLS%_" == "__" (
125        set "B2_TOOLSET_ROOT=%VS160COMNTOOLS%..\..\VC\"
126    ))
127
128if "_%B2_ARCH%_" == "__" set B2_ARCH=x86
129set B2_BUILD_ARGS=%B2_BUILD_ARGS% %B2_ARCH%
130
131REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\Source if it exists.
132pushd %CD%
133if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS%
134popd
135set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
136set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
137set "_known_=1"
138goto :eof
139
140:Config_VCUNK
141if NOT "_%B2_TOOLSET%_" == "_vcunk_" goto Skip_VCUNK
142call vswhere_usability_wrapper.cmd
143REM Reset ERRORLEVEL since from now on it's all based on ENV vars
144ver > nul 2> nul
145if "_%B2_TOOLSET_ROOT%_" == "__" (
146    if NOT "_%VSUNKCOMNTOOLS%_" == "__" (
147        set "B2_TOOLSET_ROOT=%VSUNKCOMNTOOLS%..\..\VC\"
148    ))
149
150if "_%B2_ARCH%_" == "__" set B2_ARCH=x86
151set B2_BUILD_ARGS=%B2_BUILD_ARGS% %B2_ARCH%
152
153REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\Source if it exists.
154pushd %CD%
155if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS%
156popd
157set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL"
158set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib"
159set "_known_=1"
160goto :eof
161
162:Config_BORLAND
163if not defined CXX ( set "CXX=bcc32" )
164if "_%B2_TOOLSET_ROOT%_" == "__" (
165    call guess_toolset.bat test_path bcc32.exe )
166if "_%B2_TOOLSET_ROOT%_" == "__" (
167    if not errorlevel 1 (
168        set "B2_TOOLSET_ROOT=%FOUND_PATH%..\"
169        ) )
170if not "_%B2_TOOLSET_ROOT%_" == "__" (
171    set "PATH=%B2_TOOLSET_ROOT%Bin;%PATH%"
172    )
173set "B2_CXX=%CXX% -tC -P -O2 -w- -I"%B2_TOOLSET_ROOT%Include" -L"%B2_TOOLSET_ROOT%Lib" -Nd -eb2"
174set "_known_=1"
175goto :eof
176
177:Config_COMO
178if not defined CXX ( set "CXX=como" )
179set "B2_CXX=%CXX% --inlining -o b2.exe"
180set "_known_=1"
181goto :eof
182
183:Config_GCC
184if not defined CXX ( set "CXX=g++" )
185set "B2_CXX=%CXX% -x c++ -std=c++11 -s -O3 -o b2.exe"
186set "_known_=1"
187goto :eof
188
189:Config_GCC_NOCYGWIN
190if not defined CXX ( set "CXX=g++" )
191set "B2_CXX=%CXX% -x c++ -std=c++11 -s -O3 -mno-cygwin -o b2.exe"
192set "_known_=1"
193goto :eof
194
195:Config_INTEL_WIN32
196if not defined CXX ( set "CXX=icl" )
197set "B2_CXX=%CXX% /nologo /MT /O2 /Ob2 /Gy /GF /GA /GB /Feb2"
198set "_known_=1"
199goto :eof
200
201:Config_MINGW
202if not defined CXX ( set "CXX=g++" )
203if not "_%B2_TOOLSET_ROOT%_" == "__" (
204    set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%"
205    )
206for /F "delims=" %%I in ("%CXX%") do set "PATH=%PATH%;%%~dpI"
207set "B2_CXX=%CXX% -x c++ -std=c++11 -s -O3 -o b2.exe"
208set "_known_=1"
209goto :eof
210