1*0ac341f1SConrad Meyer@ECHO OFF 2*0ac341f1SConrad Meyer 3*0ac341f1SConrad Meyerif "%1" == "" ( 4*0ac341f1SConrad Meyer echo "Usage: wintest.bat <Release | ReleaseDLL | Debug | DebugDLL" 5*0ac341f1SConrad Meyer goto :END 6*0ac341f1SConrad Meyer) 7*0ac341f1SConrad Meyer 8*0ac341f1SConrad Meyerif not exist sodium_version.c ( 9*0ac341f1SConrad Meyer CD test\default 10*0ac341f1SConrad Meyer if not exist sodium_version.c ( 11*0ac341f1SConrad Meyer echo "Are you on the right path?" %CD% 12*0ac341f1SConrad Meyer goto :END 13*0ac341f1SConrad Meyer ) 14*0ac341f1SConrad Meyer) 15*0ac341f1SConrad Meyer 16*0ac341f1SConrad Meyerif "%2" == "x64" (SET ARCH=x64) else (SET ARCH=Win32) 17*0ac341f1SConrad MeyerSET CFLAGS=/nologo /DTEST_SRCDIR=\".\" /I..\..\src\libsodium\include\sodium /I..\..\src\libsodium\include /I..\quirks 18*0ac341f1SConrad MeyerSET LDFLAGS=/link /LTCG advapi32.lib ..\..\Build\%1\%ARCH%\libsodium.lib 19*0ac341f1SConrad Meyerif "%1" == "ReleaseDLL" ( goto :ReleaseDLL ) 20*0ac341f1SConrad Meyerif "%1" == "DebugDLL" ( goto :DebugDLL ) 21*0ac341f1SConrad Meyerif "%1" == "Release" ( goto :Release ) 22*0ac341f1SConrad Meyerif "%1" == "Debug" ( goto :Debug ) 23*0ac341f1SConrad Meyerecho "Invalid build type" 24*0ac341f1SConrad Meyergoto :END 25*0ac341f1SConrad Meyer:ReleaseDLL 26*0ac341f1SConrad Meyer SET CFLAGS=%CFLAGS% /MD /Ox 27*0ac341f1SConrad Meyer SET PATH=..\..\Build\%1\%ARCH%;%PATH% 28*0ac341f1SConrad Meyer goto :COMPILE 29*0ac341f1SConrad Meyer:Release 30*0ac341f1SConrad Meyer SET CFLAGS=%CFLAGS% /MT /Ox /DSODIUM_STATIC /DSODIUM_EXPORT= 31*0ac341f1SConrad Meyer goto :COMPILE 32*0ac341f1SConrad Meyer:DebugDLL 33*0ac341f1SConrad Meyer SET CFLAGS=%CFLAGS% /GS /MDd /Od 34*0ac341f1SConrad Meyer SET PATH=..\..\Build\%1\%ARCH%;%PATH% 35*0ac341f1SConrad Meyer goto :COMPILE 36*0ac341f1SConrad Meyer:Debug 37*0ac341f1SConrad Meyer SET CFLAGS=%CFLAGS% /GS /MTd /Od /DSODIUM_STATIC /DSODIUM_EXPORT= 38*0ac341f1SConrad Meyer goto :COMPILE 39*0ac341f1SConrad Meyer:COMPILE 40*0ac341f1SConrad Meyerecho Running the test suite: 41*0ac341f1SConrad MeyerFOR %%f in (*.c) DO ( 42*0ac341f1SConrad Meyer cl %CFLAGS% %%f %LDFLAGS% /OUT:%%f.exe > NUL 2>&1 43*0ac341f1SConrad Meyer if not exist %%f.exe ( 44*0ac341f1SConrad Meyer echo %%f compile failed 45*0ac341f1SConrad Meyer goto :END 46*0ac341f1SConrad Meyer ) 47*0ac341f1SConrad Meyer %%f.exe 48*0ac341f1SConrad Meyer if errorlevel 1 ( 49*0ac341f1SConrad Meyer echo %%f failed 50*0ac341f1SConrad Meyer ) else ( 51*0ac341f1SConrad Meyer echo %%f ok 52*0ac341f1SConrad Meyer ) 53*0ac341f1SConrad Meyer) 54*0ac341f1SConrad MeyerREM Remove temporary files 55*0ac341f1SConrad Meyerdel *.exe *.obj *.res 56*0ac341f1SConrad Meyer:END 57