-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_cmd_boost.bat
296 lines (270 loc) · 10.1 KB
/
build_cmd_boost.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
@echo off
@rem set VSCMD_DEBUG=2
call :DetectVsPath VisualStudioCmd
call :DetectProgramDir ProgramDir
echo ProgramDir=%ProgramDir%
set CurDir=%~dp0
set ProjDir=%CurDir:~0,-1%
set PERL5LIB=%PERL5LIB%
set PerlPath=%ProgramDir%\Perl\bin
set NASMPath=%ProgramDir%\nasm\bin
set YASMPath=%ProgramDir%\yasm\bin
set CMakePath=%ProgramDir%\cmake\bin
set PythonHome=%ProgramDir%\python
set PATH=%NASMPath%;%YASMPath%;%PerlPath%;%CMakePath%;%PythonHome%;%PATH%
set HomeDir=%ProjDir%\out\windows
call %VisualStudioCmd% x86
set BuildType=Release
call :install_boost1830 "debug" "64" "%HomeDir%"
pause
goto :eof
:MidlProcFile
setlocal EnableDelayedExpansion
set IdlFileList=%~1
set idx=0
call :color_text 2f " +++++++++++++++++++ MidlProcFile +++++++++++++++++++++++ "
for %%i in (%IdlFileList%) do (
set /a idx+=1
set IdlFile=%%i
echo [!idx!] !IdlFile!
if exist !IdlFile! (
)
)
call :color_text 2f " -------------------- MidlProcFile ----------------------- "
endlocal
goto :eof
:DetectProgramDir
setlocal EnableDelayedExpansion
@rem SkySdk\VS2005\VC
set SkySdkDiskSet=C;D;E;F;G;
set CurProgramDir=
set idx=0
call :color_text 2f " +++++++++++++++++++ DetectProgramDir +++++++++++++++++++++++ "
for %%i in (%SkySdkDiskSet%) do (
set /a idx+=1
for /f "tokens=1-2 delims=|" %%B in ("programs|program") do (
set CurProgramDir=%%i:\%%B
echo [!idx!] !CurProgramDir!
if exist !CurProgramDir!\SkySdk (
goto :DetectProgramDirBreak
)
set CurProgramDir=%%i:\%%C
echo [!idx!] !CurProgramDir!
if exist !CurProgramDir!\SkySdk (
goto :DetectProgramDirBreak
)
)
)
:DetectProgramDirBreak
set ProgramDir=!CurProgramDir!
call :color_text 2f " ------------------- DetectProgramDir ----------------------- "
endlocal & set %~1=%ProgramDir%
goto :eof
:DetectVS2005VcDir
setlocal EnableDelayedExpansion
set OutVCInstallDir=%~1
set VisualStudioDiskSet=C;D;E;F;G;
set CurVcDir=
set idx=0
call :color_text 2f "+++++++++++++++++++DetectVS2005VcDir+++++++++++++++++++++++"
for %%i in (%VisualStudioDiskSet%) do (
set /a idx+=1
set CurVcDir="%%i:\Program Files (x86)\Microsoft Visual Studio 8\VC"
echo [!idx!] !VS80COMNTOOLS!
echo [!idx!] !CurVcDir!
if exist !CurVcDir! (
goto :DetectVS2005VcDirBreak
)
)
:DetectVS2005VcDirBreak
set VCInstallDir="!CurVcDir!"
call :color_text 2f "--------------------DetectVS2005VcDir-----------------------"
endlocal & set "%~1=%VCInstallDir%"
goto :eof
:CopyVS2005Libs
setlocal EnableDelayedExpansion
set ProjDir=%~1
call :color_text 2f "+++++++++++++++++++CopyVS2005Libs+++++++++++++++++++++++"
@rem call :DetectVS2005VcDir VCInstallDir
call :DetectProgramDir ProgramDir
set VCInstallDir=%ProgramDir%\SkySdk\VS2005\VC
set VscLib=msvcmrtd.lib;msvcrtd.lib;
set VscDir=%VCInstallDir%\lib
set VsAtlmfcLib=mfcs80d.lib atlsd.lib mfc80d.lib
set VsAtlmfcDir=%VCInstallDir%\atlmfc\lib
set FrameworkLib=kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;WS2_32.lib;winmm.lib;vfw32.lib;
set FrameworkDir=%VCInstallDir%\PlatformSDK\lib
set SkySdkLib=dsound.lib;dxguid.lib;simulator.lib;simlib.lib;jpeg_sim.lib;SIM_mr_helperexb.lib;data_codec_sim.lib;SIM_mr_helperexbnp.lib;
@rem call :CheckLibInDir "%VscLib%" "%WindowsSdkDir%" "%ProjDir%"
call :CheckLibInDir "%VscLib%" "%VscDir%" "%ProjDir%"
call :CheckLibInDir "%VsAtlmfcLib%" "%VsAtlmfcDir%" "%ProjDir%"
@rem call :CheckLibInDir "%FrameworkLib%" "%FrameworkDir%" "%ProjDir%"
@rem call :CheckLibInDir "%SkySdkLib%" "%SkySdkDir%\Simulator\lib" "%ProjDir%"
call :color_text 2f "--------------------CopyVS2005Libs-----------------------"
endlocal
goto :eof
:CheckLibInDir
setlocal EnableDelayedExpansion
set Libs=%~1
set LibDir="%~2"
set ProjDir=%~3
set MyPlatformSDK=%ProjDir%\lib
if not exist "%MyPlatformSDK%" (
mkdir %MyPlatformSDK%
)
call :color_text 2f " +++++++++++++++++++ CheckLibInDir +++++++++++++++++++++++ "
echo LibDir %LibDir%
if not exist %LibDir% (
call :color_text 4f " -------------------- CheckLibInDir ----------------------- "
goto :eof
)
pushd %LibDir%
set idx=0
for %%i in (%Libs%) do (
set /a idx+=1
set CurLib=%%i
echo [!idx!] !LibDir!\!CurLib!
if not exist !LibDir!\!CurLib! (
echo !LibDir!\!CurLib!
) else (
copy !LibDir!\!CurLib! %MyPlatformSDK%
)
)
popd
call :color_text 2f " -------------------- CheckLibInDir ----------------------- "
endlocal
goto :eof
:DetectVsPath
setlocal EnableDelayedExpansion
set VsBatFileVar=%~1
call :color_text 2f " +++++++++++++++++++ DetectVsPath +++++++++++++++++++++++ "
set VSDiskSet=C;D;E;F;G;
set AllProgramsPathSet=program
set AllProgramsPathSet=%AllProgramsPathSet%;programs
set AllProgramsPathSet=%AllProgramsPathSet%;"Program Files"
set AllProgramsPathSet=%AllProgramsPathSet%;"Program Files (x86)"
set VCPathSet=%VCPathSet%;"Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build"
set VCPathSet=%VCPathSet%;"Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build"
set VCPathSet=%VCPathSet%;SkySdk\VS2005\VC
set VCPathSet=%VCPathSet%;"Microsoft Visual Studio 8\VC"
set VCPathSet=%VCPathSet%;"Microsoft Visual Studio 12.0\VC\bin"
set VCPathSet=%VCPathSet%;"Microsoft Visual Studio 14.0\VC\bin"
set VCPathSet=%VCPathSet%;"Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build"
set idx_a=0
for %%C in (%VCPathSet%) do (
set /a idx_a+=1
set idx_b=0
for %%B in (!AllProgramsPathSet!) do (
set /a idx_b+=1
set idx_c=0
for %%A in (!VSDiskSet!) do (
set /a idx_c+=1
set CurBatFile=%%A:\%%B\%%C\vcvarsall.bat
echo [!idx_a!][!idx_b!][!idx_c!] !CurBatFile!
if exist !CurBatFile! (
goto DetectVsPathBreak
)
)
)
)
:DetectVsPathBreak
echo Use:%CurBatFile%
call :color_text 2f " -------------------- DetectVsPath ----------------------- "
endlocal & set "%~1=%CurBatFile%"
goto :eof
@rem YellowBackground 6f ef
@rem BlueBackground 9f bf 3f
@rem GreenBackground af 2f
@rem RedBackground 4f cf
@rem GreyBackground 7f 8f
@rem PurpleBackground 5f
:color_text
setlocal EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
endlocal
echo .
goto :eof
:install_boost
setlocal ENABLEDELAYEDEXPANSION
set BuildType="%~1"
set BitNum="%~2"
set HomeDir="%~3"
call :color_text 2f "++++++++++++++install_boost++++++++++++++"
@rem unzip -q boost_1_74_0.zip
@rem vs2008 <-> toolset=msvc-9.0
@rem vs2010 <-> toolset=msvc-10.0
@rem vs2013 <-> toolset=msvc-12.0
@rem vs2015 <-> toolset=msvc-14.0
@rem vs2017 <-> toolset=msvc-15.0
@rem vs2019 <-> toolset=msvc-16.0
@rem vs2022 <-> toolset=msvc-17.0
pushd boost_1_74_0
if exist .\b2.exe (
.\b2.exe install --prefix="%HomeDir%/boost_1_74_0/" --build-type=complete --toolset=msvc-17.0 variant=%BuildType% link=shared threading=multi runtime-link=shared address-model=%BitNum%
) else (
echo .\b2.exe doesn't exist!
)
if exist .\bootstrap.bat (
.\bootstrap.bat vc142
) else (
echo .\bootstrap.bat doesn't exist!
)
if exist .\b2.exe (
.\b2.exe install --prefix="%HomeDir%/boost_1_74_0/" --build-type=complete --toolset=msvc-17.0 variant=%BuildType% link=shared threading=multi runtime-link=shared address-model=%BitNum%
) else (
echo .\b2.exe doesn't exist!
)
echo BuildType=%BuildType%, BitNum=%BitNum%
set BuildDir=%BuildType%_win%BitNum%
popd
endlocal
goto :eof
:install_boost1830
setlocal ENABLEDELAYEDEXPANSION
set BuildType="%~1"
set BitNum="%~2"
set HomeDir="%~3"
call :color_text 2f "++++++++++++++install_boost++++++++++++++"
@rem unzip -q boost_1_83_0.zip
@rem vs2008 <-> toolset=msvc-9.0
@rem vs2010 <-> toolset=msvc-10.0
@rem vs2013 <-> toolset=msvc-12.0
@rem vs2015 <-> toolset=msvc-14.0
@rem vs2017 <-> toolset=msvc-15.0
@rem vs2019 <-> toolset=msvc-16.0
@rem vs2022 <-> toolset=msvc-17.0 @rem 143
pushd boost_1_83_0
if exist .\b2.exe (
.\b2.exe install --prefix="%HomeDir%/boost_1_83_0/" --build-type=complete --toolset=msvc-14.3 variant=%BuildType% link=shared threading=multi runtime-link=shared address-model=%BitNum%
) else (
echo .\b2.exe doesn't exist!
)
if exist .\bootstrap.bat (
.\bootstrap.bat vc143
) else (
echo .\bootstrap.bat doesn't exist!
)
echo BuildType=%BuildType%, BitNum=%BitNum%
set BuildDir=%BuildType%_win%BitNum%
popd
endlocal
goto :eof
:GetCurSysTime
setlocal EnableDelayedExpansion
set dateStr=
set timeStr=
set year=%date:~6,4%
set month=%date:~4,2%
set day=%date:~0,2%
set dateStr=%date: =_%
set dateStr=%dateStr:/=x%
set timeStr=%time::=x%
set timeStr=%time: =%
endlocal & set %~1=%dateStr%__%timeStr%
goto :eof