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 for %%c in (Release,Release_SSE2) do (
18 if not "%%p::%%c" == "x64::Release_SSE2" (
19 set "TEMP_NAME=!RANDOM!-!RANDOM!"
20 if "%%c"=="Release_SSE2" (set "SUFFIX=sse2") else (if "%%p"=="x86" (set "SUFFIX=i686") else (set "SUFFIX=%%p"))
21 %ECHO% white "\n------------------------------------------------------------------------------"
22 %ECHO% white "Clean [%%p:%%c]"
23 %ECHO% white "------------------------------------------------------------------------------\n"
24 MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /target:Clean /verbosity:normal "%~dp0\Slunk.sln"
25 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
26 %ECHO% white "\n------------------------------------------------------------------------------"
27 %ECHO% white "Instrument [%%p:%%c]"
28 %ECHO% white "------------------------------------------------------------------------------\n"
29 MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /property:WholeProgramOptimization=PGInstrument /property:LinkTimeCodeGeneration=PGInstrument /target:Rebuild /verbosity:normal "%~dp0\Slunk.sln"
30 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
31 %ECHO% white "\n------------------------------------------------------------------------------"
32 %ECHO% white "Profiling [%%p:%%c]"
33 %ECHO% white "------------------------------------------------------------------------------\n"
34 "%~dp0.\etc\utils\win32\rand.exe" | "%~dp0.\etc\utils\win32\head.exe" -c 104857600 > "%TMP%\!TEMP_NAME!.dat"
35 if not "%ERRORLEVEL%"=="0" goto:BuildFailed
36 "%~dp0.\bin\static\slunkcrypt-cli-!SUFFIX!.exe" --encrypt pass:"KVeW9;z4$#]d9~}z>(WC?v&f" "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc"
37 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
38 "%~dp0.\bin\static\slunkcrypt-cli-!SUFFIX!.exe" --decrypt pass:"KVeW9;z4$#]d9~}z>(WC?v&f" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out"
39 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
40 del /F "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out"
41 %ECHO% white "\n------------------------------------------------------------------------------"
42 %ECHO% white "Re-compile [%%p:%%c]"
43 %ECHO% white "------------------------------------------------------------------------------\n"
44 MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /property:WholeProgramOptimization=PGOptimize /property:LinkTimeCodeGeneration=PGOptimization /target:Build /verbosity:normal "%~dp0\Slunk.sln"
45 if not "!ERRORLEVEL!"=="0" goto:BuildFailed
50 %ECHO% green "\nBuild completed successfully.\n"
55 %ECHO% red "\nBuild has failed ^!^!^!\n"