@ECHO OFF

echo "compiling resource file with windres..."

.\..\..\_other\mingw64\bin\windres.exe my.rc -O coff -o my.res

echo "compiling for windows using mingw-gcc..."

cd .\src

 .\..\..\..\_other\mingw64\bin\gcc.exe -O3 -flto -std=gnu11 -Wall -Wextra -msse2 -o ..\quad.exe main.c text.c input.c shaders.c custom.c geometry.c sky.c terrain.c water.c fire.c player.c network.c cjson/cJSON.c ufbx/ufbx.c .\..\my.res -lm -lpthread -fstack-protector -lglew32 -lopengl32 -lgdi32 -luser32 -lkernel32 -lglfw3 -lpng16 -lz -I.\..\..\..\_other\mingw64\x86_64-w64-mingw32\include -Werror-implicit-function-declaration -flto=auto -lfreetype -I.\..\..\..\_other\mingw64\x86_64-w64-mingw32\include\freetype2 -L.\..\..\..\_other\mingw64\x86_64-w64-mingw32\lib -lftgl -I.\..\..\..\_other\mingw64\x86_64-w64-mingw32\include\FTGL -g -Bstatic
 
cd .\..



if exist .\quad.exe (
    rem file exists
	move /Y .\quad.exe .\_build\quad.exe
	ECHO "success: .\quad.exe moved to .\_build\quad.exe"
	
	if exist .\compiler_encountered_error.txt (
		DEL /F .\compiler_encountered_error.txt
	)
) else (
    rem file doesn't exist
	ECHO "-1">compiler_encountered_error.txt
)

rem remove the rem to enable pause
rem pause
