@echo off
setlocal
set GXX=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe
set WINDRES=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\windres.exe

if not exist "%GXX%" (
  echo g++ not found at %GXX%
  exit /b 1
)

echo [1/2] resources...
"%WINDRES%" -i app.rc -o app_res.o
if errorlevel 1 exit /b 1

echo [2/2] compiling...
"%GXX%" -O2 -static -mwindows main.cpp app_res.o -o RamInspector.exe ^
  -lcomctl32 -ldwmapi -lpsapi -lgdi32 -luser32 -luxtheme ^
  -lcomdlg32 -ladvapi32 -lshell32 -lole32

if errorlevel 1 exit /b 1
echo.
echo Built: RamInspector.exe
