2 setlocal enabledelayedexpansion
4 set ECHO="%~dp0.\etc\utils\win32\cecho.exe"
6 set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"
9 if not exist "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" (
10 %ECHO% red "\nMSVC not found. Please check MSVC_PATH and try again^!\n"
15 for %%p in (x86,x64) do (
16 call "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" %%p
17 set "TEMP_NAME=!RANDOM!-!RANDOM!"
18 %ECHO% white "\n------------------------------------------------------------------------------"
19 %ECHO% white "Clean [%%p]"
20 %ECHO% white "------------------------------------------------------------------------------\n"
21 MSBuild.exe /property:Configuration=Release /property:Platform=%%p /target:Clean /verbosity:normal "%~dp0\Slunk.sln"
22 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
23 %ECHO% white "\n------------------------------------------------------------------------------"
24 %ECHO% white "Instrument [%%p]"
25 %ECHO% white "------------------------------------------------------------------------------\n"
26 MSBuild.exe /property:Configuration=Release /property:Platform=%%p /property:WholeProgramOptimization=PGInstrument /property:LinkTimeCodeGeneration=PGInstrument /target:Rebuild /verbosity:normal "%~dp0\Slunk.sln"
27 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
28 %ECHO% white "\n------------------------------------------------------------------------------"
29 %ECHO% white "Profiling [%%p]"
30 %ECHO% white "------------------------------------------------------------------------------\n"
31 "%~dp0.\etc\utils\win32\rand.exe" | "%~dp0.\etc\utils\win32\head.exe" -c 104857600 > "%TMP%\!TEMP_NAME!.dat"
32 if not "%ERRORLEVEL%"=="0" goto:BuildFailed
33 "%~dp0.\bin\%%p\Release\slunkcrypt.exe" --self-test
34 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
35 "%~dp0.\bin\%%p\Release\slunkcrypt.exe" --encrypt pass:"KVeW9;z4$#]d9~}z>(WC?v&f" "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc"
36 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
37 "%~dp0.\bin\%%p\Release\slunkcrypt.exe" --decrypt pass:"KVeW9;z4$#]d9~}z>(WC?v&f" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out"
38 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
39 del /F "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out"
40 %ECHO% white "\n------------------------------------------------------------------------------"
41 %ECHO% white "Re-compile [%%p]"
42 %ECHO% white "------------------------------------------------------------------------------\n"
43 MSBuild.exe /property:Configuration=Release /property:Platform=%%p /property:WholeProgramOptimization=PGOptimize /property:LinkTimeCodeGeneration=PGOptimization /target:Build /verbosity:normal "%~dp0\Slunk.sln"
44 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
47 %ECHO% green "\nBuild completed successfully.\n"
52 %ECHO% red "\nBuild has failed ^!^!^!\n"