Home | History | Annotate | Line # | Download | only in default
      1 @ECHO OFF
      2 
      3 if "%1" == "" (
      4   echo "Usage: wintest.bat <Release | ReleaseDLL | Debug | DebugDLL"
      5 	goto :END
      6 )
      7 
      8 if 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 
     16 if "%2" == "x64" (SET ARCH=x64) else (SET ARCH=Win32)
     17 SET CFLAGS=/nologo /DTEST_SRCDIR=\".\" /I..\..\src\libsodium\include\sodium /I..\..\src\libsodium\include /I..\quirks
     18 SET LDFLAGS=/link /LTCG advapi32.lib ..\..\Build\%1\%ARCH%\libsodium.lib
     19 if "%1" == "ReleaseDLL" ( goto :ReleaseDLL )
     20 if "%1" == "DebugDLL"   ( goto :DebugDLL )
     21 if "%1" == "Release"   ( goto :Release )
     22 if "%1" == "Debug"   ( goto :Debug )
     23 echo "Invalid build type"
     24 goto :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
     40 echo Running the test suite:
     41 FOR %%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 )
     54 REM Remove temporary files
     55 del *.exe *.obj *.res 
     56 :END
     57