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