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