]> FriiDump Source - friidump.git/blob - build_msvc32.cmd
0d692113733b8da4cd0288300943abc665ead268
[friidump.git] / build_msvc32.cmd
1 @echo off
2 setlocal EnableExtensions
3 cd /d "%~dp0"
4
5 if /I "%~1"=="clean" goto clean
6
7 if not exist "config.h" (
8   echo [ERROR] config.h is missing from the source root.
9   echo Please extract the full source ZIP before building.
10   exit /b 1
11 )
12
13 findstr /n /c:"#define snprintf" "%~dp0libmultihash\multihash.h" "%~dp0libfriidump\win32compat.h" >nul 2>nul
14 if not errorlevel 1 (
15   echo [ERROR] Legacy snprintf macro still present. Overwrite libmultihash\multihash.h and libfriidump\win32compat.h from this package.
16   exit /b 1
17 )
18
19
20 if not exist "build-msvc32" mkdir "build-msvc32"
21
22 call "%~dp0.vscode\msvc32.cmd" cl @"%~dp0msvc32_friidump.rsp"
23 if errorlevel 1 exit /b %ERRORLEVEL%
24
25 set "HELP_LOG=%TEMP%\friidump-help-%RANDOM%-%RANDOM%.txt"
26 "%~dp0friidump.exe" --help > "%HELP_LOG%" 2>&1
27 type "%HELP_LOG%"
28
29 findstr /c:"FriiDump " "%HELP_LOG%" >nul
30 if errorlevel 1 (
31   echo [ERROR] FriiDump help/version smoke test failed.
32   del /q "%HELP_LOG%" >nul 2>nul
33   if exist "friidump.log" del /q "friidump.log"
34   exit /b 1
35 )
36
37 findstr /c:"Available command line options:" "%HELP_LOG%" >nul
38 if errorlevel 1 (
39   echo [ERROR] FriiDump command-line help smoke test failed.
40   del /q "%HELP_LOG%" >nul 2>nul
41   if exist "friidump.log" del /q "friidump.log"
42   exit /b 1
43 )
44
45 del /q "%HELP_LOG%" >nul 2>nul
46 if exist "friidump.log" del /q "friidump.log"
47
48 powershell -NoProfile -ExecutionPolicy Bypass -Command "Compress-Archive -Force -Path friidump.exe,docs,README,AUTHORS,COPYING,config.h,msvc32_friidump.rsp,build_msvc32.cmd,.vscode -DestinationPath friidump_msvc32_build_results.zip"
49 exit /b %ERRORLEVEL%
50
51 :clean
52 if exist "friidump.exe" del /q "friidump.exe"
53 if exist "build-msvc32" rmdir /s /q "build-msvc32"
54 if exist "friidump_msvc32_build_results.zip" del /q "friidump_msvc32_build_results.zip"
55 if exist "friidump.log" del /q "friidump.log"
56 exit /b 0