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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
@ECHO OFF
REM $Id$
REM
REM (C) 2009-2012 see Authors.txt
REM
REM This file is part of MPC-HC.
REM
REM MPC-HC is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation; either version 3 of the License, or
REM (at your option) any later version.
REM
REM MPC-HC is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM GNU General Public License for more details.
REM
REM You should have received a copy of the GNU General Public License
REM along with this program. If not, see <http://www.gnu.org/licenses/>.
SETLOCAL
CD /D %~dp0
REM pre-build checks
IF EXIST "build.user.bat" (
CALL "build.user.bat"
) ELSE (
IF DEFINED MINGW32 (SET MPCHC_MINGW32=%MINGW32%) ELSE (GOTO MissingVar)
IF DEFINED MINGW64 (SET MPCHC_MINGW64=%MINGW64%) ELSE (GOTO MissingVar)
IF DEFINED MSYS (SET MPCHC_MSYS=%MSYS%) ELSE (GOTO MissingVar)
)
IF NOT DEFINED VS100COMNTOOLS GOTO MissingVar
SET ARG=%*
SET ARG=%ARG:/=%
SET ARG=%ARG:-=%
SET ARGB=0
SET ARGBC=0
SET ARGC=0
SET ARGCL=0
SET ARGD=0
SET ARGF=0
SET ARGM=0
SET ARGPL=0
SET ARGPA=0
SET ARGIN=0
SET ARGZI=0
SET INPUT=0
IF /I "%ARG%" == "?" GOTO ShowHelp
FOR %%A IN (%ARG%) DO (
IF /I "%%A" == "help" GOTO ShowHelp
IF /I "%%A" == "GetVersion" ENDLOCAL & CALL :SubGetVersion & EXIT /B
IF /I "%%A" == "Build" SET "BUILDTYPE=Build" & SET /A ARGB+=1
IF /I "%%A" == "Clean" SET "BUILDTYPE=Clean" & SET /A ARGB+=1 & SET /A ARGCL+=1
IF /I "%%A" == "Rebuild" SET "BUILDTYPE=Rebuild" & SET /A ARGB+=1
IF /I "%%A" == "Both" SET "PLATFORM=Both" & SET /A ARGPL+=1
IF /I "%%A" == "Win32" SET "PLATFORM=Win32" & SET /A ARGPL+=1
IF /I "%%A" == "x86" SET "PLATFORM=Win32" & SET /A ARGPL+=1
IF /I "%%A" == "x64" SET "PLATFORM=x64" & SET /A ARGPL+=1
IF /I "%%A" == "All" SET "CONFIG=All" & SET /A ARGC+=1
IF /I "%%A" == "Main" SET "CONFIG=Main" & SET /A ARGC+=1 & SET /A ARGM+=1
IF /I "%%A" == "Filters" SET "CONFIG=Filters" & SET /A ARGC+=1 & SET /A ARGF+=1
IF /I "%%A" == "Filter" SET "CONFIG=Filters" & SET /A ARGC+=1 & SET /A ARGF+=1
IF /I "%%A" == "MPCHC" SET "CONFIG=MPCHC" & SET /A ARGC+=1
IF /I "%%A" == "MPC-HC" SET "CONFIG=MPCHC" & SET /A ARGC+=1
IF /I "%%A" == "Resource" SET "CONFIG=Resources" & SET /A ARGC+=1 & SET /A ARGD+=1
IF /I "%%A" == "Resources" SET "CONFIG=Resources" & SET /A ARGC+=1 & SET /A ARGD+=1
IF /I "%%A" == "Debug" SET "BUILDCFG=Debug" & SET /A ARGBC+=1 & SET /A ARGD+=1
IF /I "%%A" == "Release" SET "BUILDCFG=Release" & SET /A ARGBC+=1
IF /I "%%A" == "Packages" SET "PACKAGES=True" & SET /A ARGPA+=1 & SET /A ARGCL+=1 & SET /A ARGD+=1 & SET /A ARGF+=1 & SET /A ARGM+=1
IF /I "%%A" == "Installer" SET "INSTALLER=True" & SET /A ARGIN+=1 & SET /A ARGCL+=1 & SET /A ARGD+=1 & SET /A ARGF+=1 & SET /A ARGM+=1
IF /I "%%A" == "Zip" SET "ZIP=True" & SET /A ARGZI+=1 & SET /A ARGCL+=1 & SET /A ARGM+=1
IF /I "%%A" == "7z" SET "ZIP=True" & SET /A ARGZI+=1 & SET /A ARGCL+=1 & SET /A ARGM+=1
)
FOR %%X IN (%*) DO SET /A INPUT+=1
SET /A VALID=%ARGB%+%ARGPL%+%ARGC%+%ARGBC%+%ARGPA%+%ARGIN%+%ARGZI%
IF %VALID% NEQ %INPUT% GOTO UnsupportedSwitch
IF %ARGB% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGB% == 0 (SET "BUILDTYPE=Build")
IF %ARGPL% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGPL% == 0 (SET "PLATFORM=Both")
IF %ARGC% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGC% == 0 (SET "CONFIG=MPCHC")
IF %ARGBC% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGBC% == 0 (SET "BUILDCFG=Release")
IF %ARGPA% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGPA% == 0 (SET "PACKAGES=False")
IF %ARGIN% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGIN% == 0 (SET "INSTALLER=False")
IF %ARGZI% GTR 1 (GOTO UnsupportedSwitch) ELSE IF %ARGZI% == 0 (SET "ZIP=False")
IF %ARGCL% GTR 1 (GOTO UnsupportedSwitch)
IF %ARGD% GTR 1 (GOTO UnsupportedSwitch)
IF %ARGF% GTR 1 (GOTO UnsupportedSwitch)
IF %ARGM% GTR 1 (GOTO UnsupportedSwitch)
IF /I "%PACKAGES%" == "True" SET "INSTALLER=True" & SET "ZIP=True"
:Start
REM Check if the %LOG_DIR% folder exists otherwise MSBuild will fail
SET "LOG_DIR=bin\logs"
IF NOT EXIST "%LOG_DIR%" MD "%LOG_DIR%"
CALL :SubDetectWinArch
SET "MSBUILD=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
SET "MSBUILD_SWITCHES=/nologo /consoleloggerparameters:Verbosity=minimal /maxcpucount /nodeReuse:true"
SET START_TIME=%TIME%
SET START_DATE=%DATE%
IF /I "%PLATFORM%" == "Win32" (GOTO Win32) ELSE IF /I "%PLATFORM%" == "x64" (GOTO x64)
:Win32
CALL "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" x86
IF /I "%CONFIG%" == "Filters" (
CALL :SubFilters Win32
IF /I "%ZIP%" == "True" CALL :SubCreatePackages Filters Win32
GOTO x64
)
IF /I "%CONFIG%" == "Resources" CALL :SubResources Win32 && GOTO x64
CALL :SubMPCHC Win32
IF /I "%CONFIG%" == "Main" GOTO x64
CALL :SubResources Win32
IF /I "%INSTALLER%" == "True" CALL :SubCreateInstaller Win32
IF /I "%ZIP%" == "True" CALL :SubCreatePackages MPC-HC Win32
IF /I "%CONFIG%" == "All" (
CALL :SubFilters Win32
IF /I "%ZIP%" == "True" CALL :SubCreatePackages Filters Win32
)
:x64
IF /I "%PLATFORM%" == "Win32" GOTO End
CALL "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" %x64_type%
IF /I "%CONFIG%" == "Filters" (
CALL :SubFilters x64
IF /I "%ZIP%" == "True" CALL :SubCreatePackages Filters x64
GOTO END
)
IF /I "%CONFIG%" == "Resources" CALL :SubResources x64 && GOTO END
CALL :SubMPCHC x64
IF /I "%CONFIG%" == "Main" GOTO End
CALL :SubResources x64
IF /I "%INSTALLER%" == "True" CALL :SubCreateInstaller x64
IF /I "%ZIP%" == "True" CALL :SubCreatePackages MPC-HC x64
IF /I "%CONFIG%" == "All" (
CALL :SubFilters x64
IF /I "%ZIP%" == "True" CALL :SubCreatePackages Filters x64
)
:End
TITLE Compiling MPC-HC [FINISHED]
SET END_TIME=%TIME%
CALL :SubGetDuration
CALL :SubMsg "INFO" "Compilation started on %START_DATE%-%START_TIME% and completed on %DATE%-%END_TIME% [%DURATION%]"
ENDLOCAL
EXIT /B
:SubFilters
TITLE Compiling MPC-HC Filters - %BUILDCFG% Filter^|%1...
REM Call update_version.bat before building the filters
CALL "update_version.bat"
"%MSBUILD%" mpc-hc.sln %MSBUILD_SWITCHES%^
/target:%BUILDTYPE% /property:Configuration="%BUILDCFG% Filter";Platform=%1^
/flp1:LogFile=%LOG_DIR%\filters_errors_%BUILDCFG%_%1.log;errorsonly;Verbosity=diagnostic^
/flp2:LogFile=%LOG_DIR%\filters_warnings_%BUILDCFG%_%1.log;warningsonly;Verbosity=diagnostic
IF %ERRORLEVEL% NEQ 0 (
CALL :SubMsg "ERROR" "mpc-hc.sln %BUILDCFG% Filter %1 - Compilation failed!"
) ELSE (
CALL :SubMsg "INFO" "mpc-hc.sln %BUILDCFG% Filter %1 compiled successfully"
)
EXIT /B
:SubMPCHC
TITLE Compiling MPC-HC - %BUILDCFG%^|%1...
"%MSBUILD%" mpc-hc.sln %MSBUILD_SWITCHES%^
/target:%BUILDTYPE% /property:Configuration=%BUILDCFG%;Platform=%1^
/flp1:LogFile=%LOG_DIR%\mpc-hc_errors_%BUILDCFG%_%1.log;errorsonly;Verbosity=diagnostic^
/flp2:LogFile=%LOG_DIR%\mpc-hc_warnings_%BUILDCFG%_%1.log;warningsonly;Verbosity=diagnostic
IF %ERRORLEVEL% NEQ 0 (
CALL :SubMsg "ERROR" "mpc-hc.sln %BUILDCFG% %1 - Compilation failed!"
) ELSE (
CALL :SubMsg "INFO" "mpc-hc.sln %BUILDCFG% %1 compiled successfully"
)
EXIT /B
:SubResources
IF /I "%BUILDCFG%" == "Debug" (
CALL :SubMsg "WARNING" "/debug was used, resources will not be built."
EXIT /B
)
TITLE Compiling mpciconlib - Release^|%1...
"%MSBUILD%" mpciconlib.sln %MSBUILD_SWITCHES%^
/target:%BUILDTYPE% /property:Configuration=Release;Platform=%1
IF %ERRORLEVEL% NEQ 0 (
CALL :SubMsg "ERROR" "mpciconlib.sln %1 - Compilation failed!"
) ELSE (
CALL :SubMsg "INFO" "mpciconlib.sln %1 compiled successfully"
)
FOR %%A IN ("Armenian" "Basque" "Belarusian" "Catalan" "Chinese Simplified"
"Chinese Traditional" "Czech" "Dutch" "French" "German" "Hebrew" "Hungarian"
"Italian" "Japanese" "Korean" "Polish" "Portuguese" "Russian" "Slovak" "Spanish"
"Swedish" "Turkish" "Ukrainian"
) DO (
TITLE Compiling mpcresources - %%~A^|%1...
"%MSBUILD%" mpcresources.sln %MSBUILD_SWITCHES%^
/target:%BUILDTYPE% /property:Configuration="Release %%~A";Platform=%1
IF %ERRORLEVEL% NEQ 0 CALL :SubMsg "ERROR" "Compilation failed!"
)
EXIT /B
:SubCopyDXDll
PUSHD "bin"
EXPAND "%DXSDK_DIR%\Redist\Jun2010_D3DCompiler_43_%~1.cab" -F:D3DCompiler_43.dll mpc-hc_%~1 >NUL
EXPAND "%DXSDK_DIR%\Redist\Jun2010_d3dx9_43_%~1.cab" -F:d3dx9_43.dll mpc-hc_%~1 >NUL
POPD
EXIT /B
:SubCreateInstaller
IF /I "%~1" == "x64" (
SET MPCHC_INNO_DEF=%MPCHC_INNO_DEF% /Dx64Build
CALL :SubCopyDXDll x64
) ELSE CALL :SubCopyDXDll x86
CALL :SubDetectInnoSetup
IF NOT DEFINED InnoSetupPath (
CALL :SubMsg "WARNING" "Inno Setup wasn't found, the %1 installer wasn't built"
EXIT /B
)
TITLE Compiling %1 installer...
"%InnoSetupPath%\ISCC.exe" /Q /O"bin" "distrib\mpc-hc_setup.iss" %MPCHC_INNO_DEF%
IF %ERRORLEVEL% NEQ 0 CALL :SubMsg "ERROR" "Compilation failed!"
CALL :SubMsg "INFO" "%1 installer successfully built"
EXIT /B
:SubCreatePackages
CALL :SubDetectSevenzipPath
CALL :SubGetVersion
IF NOT DEFINED SEVENZIP (
CALL :SubMsg "WARNING" "7-Zip wasn't found, the %1 %2 package wasn't built"
EXIT /B
)
IF /I "%~1" == "Filters" (SET "NAME=MPC-HC_standalone_filters") ELSE (SET "NAME=MPC-HC")
IF /I "%~2" == "Win32" (
SET ARCH=x86
CALL :SubCopyDXDll x86
) ELSE (
SET ARCH=x64
CALL :SubCopyDXDll x64
)
PUSHD "bin"
SET "PCKG_NAME=%NAME%.%MPCHC_VER%.%ARCH%"
IF EXIST "%PCKG_NAME%.7z" DEL "%PCKG_NAME%.7z"
IF EXIST "%PCKG_NAME%.pdb.7z" DEL "%PCKG_NAME%.pdb.7z"
IF EXIST "%PCKG_NAME%" RD /Q /S "%PCKG_NAME%"
REM Compress the pdb file for mpc-hc only
IF /I "%NAME%" == "MPC-HC" (
PUSHD "%~1_%ARCH%"
TITLE Creating archive %PCKG_NAME%.pdb.7z...
START "7z" /B /WAIT "%SEVENZIP%" a -t7z "%PCKG_NAME%.pdb.7z" "*.pdb" -m0=LZMA -mx9 -ms=on
IF %ERRORLEVEL% NEQ 0 CALL :SubMsg "ERROR" "Unable to create %PCKG_NAME%.pdb.7z!"
CALL :SubMsg "INFO" "%PCKG_NAME%.pdb.7z successfully created"
IF EXIST "%PCKG_NAME%.pdb.7z" MOVE /Y "%PCKG_NAME%.pdb.7z" ".." >NUL
POPD
)
TITLE Copying %PCKG_NAME%...
IF NOT EXIST "%PCKG_NAME%" MD "%PCKG_NAME%"
IF /I "%NAME%" == "MPC-HC" (
IF NOT EXIST "%PCKG_NAME%\Lang" MD "%PCKG_NAME%\Lang"
IF /I "%ARCH%" == "x64" (
COPY /Y /V "%~1_%ARCH%\mpc-hc64.exe" "%PCKG_NAME%\mpc-hc64.exe" >NUL
) ELSE (
COPY /Y /V "%~1_%ARCH%\mpc-hc.exe" "%PCKG_NAME%\mpc-hc.exe" >NUL
)
COPY /Y /V "%~1_%ARCH%\mpciconlib.dll" "%PCKG_NAME%\*.dll" >NUL
COPY /Y /V "%~1_%ARCH%\Lang\mpcresources.??.dll" "%PCKG_NAME%\Lang\mpcresources.??.dll" >NUL
COPY /Y /V "%~1_%ARCH%\D3DCompiler_43.dll" "%PCKG_NAME%\D3DCompiler_43.dll" >NUL
COPY /Y /V "%~1_%ARCH%\d3dx9_43.dll" "%PCKG_NAME%\d3dx9_43.dll" >NUL
) ELSE (
COPY /Y /V "%~1_%ARCH%\*.ax" "%PCKG_NAME%\*.ax" >NUL
COPY /Y /V "%~1_%ARCH%\VSFilter.dll" "%PCKG_NAME%\VSFilter.dll" >NUL
)
COPY /Y /V "..\COPYING.txt" "%PCKG_NAME%" >NUL
COPY /Y /V "..\docs\Authors.txt" "%PCKG_NAME%" >NUL
COPY /Y /V "..\docs\Changelog.txt" "%PCKG_NAME%" >NUL
COPY /Y /V "..\docs\Readme.txt" "%PCKG_NAME%" >NUL
TITLE Creating archive %PCKG_NAME%.7z...
START "7z" /B /WAIT "%SEVENZIP%" a -t7z "%PCKG_NAME%.7z" "%PCKG_NAME%"^
-m0=LZMA -mx9 -ms=on
IF %ERRORLEVEL% NEQ 0 CALL :SubMsg "ERROR" "Unable to create %PCKG_NAME%.7z!"
CALL :SubMsg "INFO" "%PCKG_NAME%.7z successfully created"
IF EXIST "%PCKG_NAME%" RD /Q /S "%PCKG_NAME%"
POPD
EXIT /B
:SubGetVersion
REM Get the version
FOR /F "tokens=3,4 delims= " %%A IN (
'FINDSTR /I /L /C:"define MPC_VERSION_MAJOR" "include\Version.h"') DO (SET "VerMajor=%%A")
FOR /F "tokens=3,4 delims= " %%A IN (
'FINDSTR /I /L /C:"define MPC_VERSION_MINOR" "include\Version.h"') DO (SET "VerMinor=%%A")
FOR /F "tokens=3,4 delims= " %%A IN (
'FINDSTR /I /L /C:"define MPC_VERSION_PATCH" "include\Version.h"') DO (SET "VerPatch=%%A")
FOR /F "tokens=3,4 delims= " %%A IN (
'FINDSTR /I /L /C:"define MPC_VERSION_REV" "include\Version_rev.h"') DO (SET "VerRev=%%A")
SET MPCHC_VER=%VerMajor%.%VerMinor%.%VerPatch%.%VerRev%
EXIT /B
:SubDetectWinArch
IF DEFINED PROGRAMFILES(x86) (SET x64_type=amd64) ELSE (SET x64_type=x86_amd64)
EXIT /B
:SubDetectInnoSetup
REM Detect if we are running on 64bit WIN and use Wow6432Node, and set the path
REM of Inno Setup accordingly
IF /I "%x64_type%" == "amd64" (
SET "U_=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
) ELSE (
SET "U_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
)
FOR /F "delims=" %%A IN (
'REG QUERY "%U_%\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>Nul ^|FIND "REG_SZ"') DO (
SET "InnoSetupPath=%%A" & CALL :SubInnoSetupPath %%InnoSetupPath:*Z=%%)
EXIT /B
:SubDetectSevenzipPath
IF EXIST "%PROGRAMFILES%\7za.exe" (SET "SEVENZIP=%PROGRAMFILES%\7za.exe" & EXIT /B)
IF EXIST "7za.exe" (SET "SEVENZIP=7za.exe" & EXIT /B)
FOR %%A IN (7z.exe) DO (SET "SEVENZIP_PATH=%%~$PATH:A")
IF EXIST "%SEVENZIP_PATH%" (SET "SEVENZIP=%SEVENZIP_PATH%" & EXIT /B)
FOR %%A IN (7za.exe) DO (SET "SEVENZIP_PATH=%%~$PATH:A")
IF EXIST "%SEVENZIP_PATH%" (SET "SEVENZIP=%SEVENZIP_PATH%" & EXIT /B)
IF /I "%x64_type%" == "amd64" (
FOR /F "delims=" %%A IN (
'REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\7-Zip" /v "Path" 2^>Nul ^| FIND "REG_SZ"') DO (
SET "SEVENZIP_REG=%%A" & CALL :SubSevenzipPath %%SEVENZIP_REG:*REG_SZ=%%
)
)
FOR /F "delims=" %%A IN (
'REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip" /v "Path" 2^>Nul ^| FIND "REG_SZ"') DO (
SET "SEVENZIP_REG=%%A" & CALL :SubSevenzipPath %%SEVENZIP_REG:*REG_SZ=%%
)
EXIT /B
:ShowHelp
TITLE %~nx0 Help
ECHO.
ECHO Usage:
ECHO %~nx0 [Clean^|Build^|Rebuild] [x86^|x64^|Both] [Main^|Resources^|MPCHC^|Filters^|All] [Debug^|Release] [Packages^|Installer^|Zip]
ECHO.
ECHO Notes: You can also prefix the commands with "-", "--" or "/".
ECHO Debug only applies to mpc-hc.sln.
ECHO The arguments are not case sensitive and can be ommitted.
ECHO. & ECHO.
ECHO Executing %~nx0 without any arguments will use the default ones:
ECHO "%~nx0 Build Both MPCHC Release"
ECHO. & ECHO.
ECHO Examples:
ECHO %~nx0 x86 Resources -Builds the x86 resources
ECHO %~nx0 Resources -Builds both x86 and x64 resources
ECHO %~nx0 x86 -Builds x86 Main exe and the x86 resources
ECHO %~nx0 x86 Debug -Builds x86 Main Debug exe and x86 resources
ECHO %~nx0 x86 Filters -Builds x86 Filters
ECHO %~nx0 x86 All -Builds x86 Main exe, x86 Filters and the x86 resources
ECHO %~nx0 x86 Packages -Builds x86 Main exe, x86 resources and creates the installer and the .7z package
ECHO.
ENDLOCAL
EXIT /B
:MissingVar
COLOR 0C
TITLE Compiling MPC-HC [ERROR]
ECHO Not all build dependencies were found.
ECHO.
ECHO See "docs\Compilation.txt" for more information.
ECHO. & ECHO.
ECHO Press any key to exit...
PAUSE >NUL
ENDLOCAL
EXIT /B
:UnsupportedSwitch
ECHO.
ECHO Unsupported commandline switch!
ECHO.
ECHO "%~nx0 %*"
ECHO.
ECHO Run "%~nx0 help" for details about the commandline switches.
CALL :SubMsg "ERROR" "Compilation failed!"
:SubInnoSetupPath
SET InnoSetupPath=%*
EXIT /B
:SubSevenzipPath
SET "SEVENZIP=%*\7z.exe"
EXIT /B
:SubMsg
ECHO. & ECHO ------------------------------
IF /I "%~1" == "ERROR" (
CALL :SubColorText "0C" "[%~1]" & ECHO %~2
) ELSE IF /I "%~1" == "INFO" (
CALL :SubColorText "0A" "[%~1]" & ECHO %~2
) ELSE IF /I "%~1" == "WARNING" (
CALL :SubColorText "0E" "[%~1]" & ECHO %~2
)
ECHO ------------------------------ & ECHO.
IF /I "%~1" == "ERROR" (
ECHO Press any key to close this window...
PAUSE >NUL
ENDLOCAL
EXIT
) ELSE (
EXIT /B
)
:SubColorText
FOR /F "tokens=1,2 delims=#" %%A IN (
'"PROMPT #$H#$E# & ECHO ON & FOR %%B IN (1) DO REM"') DO (
SET "DEL=%%A")
<NUL SET /p ".=%DEL%" > "%~2"
FINDSTR /v /a:%1 /R ".18" "%~2" NUL
DEL "%~2" > NUL 2>&1
EXIT /B
:SubGetDuration
SET START_TIME=%START_TIME: =%
SET END_TIME=%END_TIME: =%
FOR /F "tokens=1-4 delims=:.," %%A IN ("%START_TIME%") DO (
SET /A "STARTTIME=(100%%A %% 100) * 360000 + (100%%B %% 100) * 6000 + (100%%C %% 100) * 100 + (100%%D %% 100)"
)
FOR /F "tokens=1-4 delims=:.," %%A IN ("%END_TIME%") DO (
SET /A "ENDTIME=(100%%A %% 100) * 360000 + (100%%B %% 100) * 6000 + (100%%C %% 100) * 100 + (100%%D %% 100)"
)
SET /A DURATION=%ENDTIME%-%STARTTIME%
IF %ENDTIME% LSS %STARTTIME% SET /A "DURATION+=24 * 360000"
SET /A DURATIONH=%DURATION% / 360000
SET /A DURATIONM=(%DURATION% - %DURATIONH%*360000) / 6000
SET /A DURATIONS=(%DURATION% - %DURATIONH%*360000 - %DURATIONM%*6000) / 100
SET /A DURATIONHS=(%DURATION% - %DURATIONH%*360000 - %DURATIONM%*6000 - %DURATIONS%*100)*10
IF %DURATIONH% EQU 0 (SET DURATIONH=) ELSE (SET DURATIONH=%DURATIONH%h )
IF %DURATIONM% EQU 0 (SET DURATIONM=) ELSE (SET DURATIONM=%DURATIONM%m )
IF %DURATIONS% EQU 0 (SET DURATIONS=) ELSE (SET DURATIONS=%DURATIONS%s )
IF %DURATIONHS% EQU 0 (SET DURATIONHS=) ELSE (SET DURATIONHS=%DURATIONHS%ms)
SET "DURATION=%DURATIONH%%DURATIONM%%DURATIONS%%DURATIONHS%"
EXIT /B
|