]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | @ECHO OFF\r |
2 | \r | |
3 | REM ~ Copyright 2002-2007 Rene Rivera.\r | |
4 | REM ~ Distributed under the Boost Software License, Version 1.0.\r | |
5 | REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)\r | |
6 | \r | |
7 | setlocal\r | |
8 | goto Start\r | |
9 | \r | |
10 | \r | |
11 | :Set_Error\r | |
12 | color 00\r | |
13 | goto :eof\r | |
14 | \r | |
15 | \r | |
16 | :Clear_Error\r | |
17 | ver >nul\r | |
18 | goto :eof\r | |
19 | \r | |
20 | \r | |
21 | :Error_Print\r | |
22 | REM Output an error message and set the errorlevel to indicate failure.\r | |
23 | setlocal\r | |
24 | ECHO ###\r | |
25 | ECHO ### %1\r | |
26 | ECHO ###\r | |
27 | ECHO ### You can specify the toolset as the argument, i.e.:\r | |
28 | ECHO ### .\build.bat msvc\r | |
29 | ECHO ###\r | |
30 | ECHO ### Toolsets supported by this script are: borland, como, gcc,\r | |
31 | ECHO ### gcc-nocygwin, intel-win32, metrowerks, mingw,\r | |
32 | ECHO ### vc12, vc14, vc141, vc142\r | |
33 | ECHO ###\r | |
34 | ECHO ### If you have Visual Studio 2017 installed you will need to either update\r | |
35 | ECHO ### the Visual Studio 2017 installer or run from VS 2017 Command Prompt\r | |
36 | ECHO ### as we where unable to detect your toolset installation.\r | |
37 | ECHO ###\r | |
38 | call :Set_Error\r | |
39 | endlocal\r | |
40 | goto :eof\r | |
41 | \r | |
42 | \r | |
43 | :Test_Option\r | |
44 | REM Tests whether the given string is in the form of an option: "--*"\r | |
45 | call :Clear_Error\r | |
46 | setlocal\r | |
47 | set test=%1\r | |
48 | if not defined test (\r | |
49 | call :Set_Error\r | |
50 | goto Test_Option_End\r | |
51 | )\r | |
52 | set test=###%test%###\r | |
53 | set test=%test:"###=%\r | |
54 | set test=%test:###"=%\r | |
55 | set test=%test:###=%\r | |
56 | if not "-" == "%test:~1,1%" call :Set_Error\r | |
57 | :Test_Option_End\r | |
58 | endlocal\r | |
59 | goto :eof\r | |
60 | \r | |
61 | \r | |
62 | :Test_Empty\r | |
63 | REM Tests whether the given string is not empty\r | |
64 | call :Clear_Error\r | |
65 | setlocal\r | |
66 | set test=%1\r | |
67 | if not defined test (\r | |
68 | call :Clear_Error\r | |
69 | goto Test_Empty_End\r | |
70 | )\r | |
71 | set test=###%test%###\r | |
72 | set test=%test:"###=%\r | |
73 | set test=%test:###"=%\r | |
74 | set test=%test:###=%\r | |
75 | if not "" == "%test%" call :Set_Error\r | |
76 | :Test_Empty_End\r | |
77 | endlocal\r | |
78 | goto :eof\r | |
79 | \r | |
80 | \r | |
81 | :Guess_Toolset\r | |
82 | set local\r | |
83 | REM Try and guess the toolset to bootstrap the build with...\r | |
84 | REM Sets B2_TOOLSET to the first found toolset.\r | |
85 | REM May also set B2_TOOLSET_ROOT to the\r | |
86 | REM location of the found toolset.\r | |
87 | \r | |
88 | call :Clear_Error\r | |
89 | call :Test_Empty "%ProgramFiles%"\r | |
90 | if not errorlevel 1 set "ProgramFiles=C:\Program Files"\r | |
91 | \r | |
92 | REM Visual Studio is by default installed to %ProgramFiles% on 32-bit machines and\r | |
93 | REM %ProgramFiles(x86)% on 64-bit machines. Making a common variable for both.\r | |
94 | call :Clear_Error\r | |
95 | call :Test_Empty "%ProgramFiles(x86)%"\r | |
96 | if errorlevel 1 (\r | |
97 | set "VS_ProgramFiles=%ProgramFiles(x86)%"\r | |
98 | ) else (\r | |
99 | set "VS_ProgramFiles=%ProgramFiles%"\r | |
100 | )\r | |
101 | \r | |
102 | call guess_toolset.bat\r | |
103 | if errorlevel 1 (\r | |
104 | call :Error_Print "Could not find a suitable toolset.")\r | |
105 | goto :eof\r | |
106 | \r | |
107 | endlocal\r | |
108 | goto :eof\r | |
109 | \r | |
110 | \r | |
111 | :Start\r | |
112 | set B2_TOOLSET=\r | |
113 | set B2_BUILD_ARGS=\r | |
114 | \r | |
115 | REM If no arguments guess the toolset;\r | |
116 | REM or if first argument is an option guess the toolset;\r | |
117 | REM otherwise the argument is the toolset to use.\r | |
118 | call :Clear_Error\r | |
119 | call :Test_Empty %1\r | |
120 | if not errorlevel 1 (\r | |
121 | call :Guess_Toolset\r | |
122 | if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )\r | |
123 | )\r | |
124 | \r | |
125 | call :Clear_Error\r | |
126 | call :Test_Option %1\r | |
127 | if not errorlevel 1 (\r | |
128 | call :Guess_Toolset\r | |
129 | if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )\r | |
130 | )\r | |
131 | \r | |
132 | call :Clear_Error\r | |
133 | set B2_TOOLSET=%1\r | |
134 | shift\r | |
135 | goto Setup_Toolset\r | |
136 | \r | |
137 | \r | |
138 | :Setup_Toolset\r | |
139 | REM Setup the toolset command and options. This bit of code\r | |
140 | REM needs to be flexible enough to handle both when\r | |
141 | REM the toolset was guessed at and found, or when the toolset\r | |
142 | REM was indicated in the command arguments.\r | |
143 | REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way\r | |
144 | REM because in BAT variables are subsituted only once during a single\r | |
145 | REM command. A complete "if ... else ..."\r | |
146 | REM is a single command, even though it's in multiple lines here.\r | |
147 | :Setup_Args\r | |
148 | call :Clear_Error\r | |
149 | call :Test_Empty %1\r | |
150 | if not errorlevel 1 goto Config_Toolset\r | |
151 | call :Clear_Error\r | |
152 | call :Test_Option %1\r | |
153 | if errorlevel 1 (\r | |
154 | set B2_BUILD_ARGS=%B2_BUILD_ARGS% %1\r | |
155 | shift\r | |
156 | goto Setup_Args\r | |
157 | )\r | |
158 | :Config_Toolset\r | |
159 | call config_toolset.bat\r | |
160 | if "_%_known_%_" == "__" (\r | |
161 | call :Error_Print "Unknown toolset: %B2_TOOLSET%"\r | |
162 | )\r | |
163 | if errorlevel 1 goto Finish\r | |
164 | \r | |
165 | echo ###\r | |
166 | echo ### Using '%B2_TOOLSET%' toolset.\r | |
167 | echo ###\r | |
168 | \r | |
169 | set B2_SOURCES=\r | |
170 | set B2_SOURCES=%B2_SOURCES% builtins.cpp class.cpp\r | |
171 | set B2_SOURCES=%B2_SOURCES% command.cpp compile.cpp constants.cpp cwd.cpp\r | |
172 | set B2_SOURCES=%B2_SOURCES% debug.cpp debugger.cpp\r | |
173 | set B2_SOURCES=%B2_SOURCES% execcmd.cpp execnt.cpp filent.cpp filesys.cpp frames.cpp function.cpp\r | |
174 | set B2_SOURCES=%B2_SOURCES% glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam.cpp\r | |
175 | set B2_SOURCES=%B2_SOURCES% jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp\r | |
176 | set B2_SOURCES=%B2_SOURCES% native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp\r | |
177 | set B2_SOURCES=%B2_SOURCES% pathsys.cpp regexp.cpp rules.cpp scan.cpp search.cpp jam_strings.cpp\r | |
178 | set B2_SOURCES=%B2_SOURCES% startup.cpp subst.cpp sysinfo.cpp\r | |
179 | set B2_SOURCES=%B2_SOURCES% timestamp.cpp variable.cpp w32_getreg.cpp\r | |
180 | set B2_SOURCES=%B2_SOURCES% modules/order.cpp\r | |
181 | set B2_SOURCES=%B2_SOURCES% modules/path.cpp\r | |
182 | set B2_SOURCES=%B2_SOURCES% modules/property-set.cpp\r | |
183 | set B2_SOURCES=%B2_SOURCES% modules/regex.cpp\r | |
184 | set B2_SOURCES=%B2_SOURCES% modules/sequence.cpp\r | |
185 | set B2_SOURCES=%B2_SOURCES% modules/set.cpp\r | |
186 | \r | |
187 | set B2_CXXFLAGS=%B2_CXXFLAGS% -DNDEBUG\r | |
188 | \r | |
189 | @echo ON\r | |
190 | %B2_CXX% %CXXFLAGS% %B2_CXXFLAGS% %B2_SOURCES% %B2_CXX_LINK%\r | |
191 | dir *.exe\r | |
192 | copy /b .\b2.exe .\bjam.exe\r | |
193 | \r | |
194 | :Finish\r | |
195 | @exit /b %ERRORLEVEL%\r |