2013-10-19 21:06:55 -07:00
|
|
|
@ECHO OFF
|
|
|
|
|
|
|
|
if "%1" == "" (
|
2023-09-10 14:25:41 -07:00
|
|
|
echo "Usage: wintest.bat <Release | ReleaseDLL | Debug | DebugDLL"
|
2013-10-19 21:06:55 -07:00
|
|
|
goto :END
|
|
|
|
)
|
|
|
|
|
|
|
|
if not exist sodium_version.c (
|
2013-10-21 20:07:05 -07:00
|
|
|
CD test\default
|
|
|
|
if not exist sodium_version.c (
|
|
|
|
echo "Are you on the right path?" %CD%
|
|
|
|
goto :END
|
|
|
|
)
|
2013-10-19 21:06:55 -07:00
|
|
|
)
|
|
|
|
|
2023-09-10 14:25:41 -07:00
|
|
|
if "%2" == "x64" (SET ARCH=x64) else (SET ARCH=Win32)
|
2013-10-19 21:06:55 -07:00
|
|
|
SET CFLAGS=/nologo /DTEST_SRCDIR=\".\" /I..\..\src\libsodium\include\sodium /I..\..\src\libsodium\include /I..\quirks
|
|
|
|
SET LDFLAGS=/link /LTCG advapi32.lib ..\..\Build\%1\%ARCH%\libsodium.lib
|
|
|
|
if "%1" == "ReleaseDLL" ( goto :ReleaseDLL )
|
|
|
|
if "%1" == "DebugDLL" ( goto :DebugDLL )
|
|
|
|
if "%1" == "Release" ( goto :Release )
|
|
|
|
if "%1" == "Debug" ( goto :Debug )
|
|
|
|
echo "Invalid build type"
|
|
|
|
goto :END
|
|
|
|
:ReleaseDLL
|
|
|
|
SET CFLAGS=%CFLAGS% /MD /Ox
|
|
|
|
SET PATH=..\..\Build\%1\%ARCH%;%PATH%
|
|
|
|
goto :COMPILE
|
|
|
|
:Release
|
|
|
|
SET CFLAGS=%CFLAGS% /MT /Ox /DSODIUM_STATIC /DSODIUM_EXPORT=
|
|
|
|
goto :COMPILE
|
|
|
|
:DebugDLL
|
|
|
|
SET CFLAGS=%CFLAGS% /GS /MDd /Od
|
|
|
|
SET PATH=..\..\Build\%1\%ARCH%;%PATH%
|
|
|
|
goto :COMPILE
|
|
|
|
:Debug
|
|
|
|
SET CFLAGS=%CFLAGS% /GS /MTd /Od /DSODIUM_STATIC /DSODIUM_EXPORT=
|
|
|
|
goto :COMPILE
|
|
|
|
:COMPILE
|
2013-10-21 20:11:56 -07:00
|
|
|
echo Running the test suite:
|
2013-10-19 21:06:55 -07:00
|
|
|
FOR %%f in (*.c) DO (
|
|
|
|
cl %CFLAGS% %%f %LDFLAGS% /OUT:%%f.exe > NUL 2>&1
|
|
|
|
if not exist %%f.exe (
|
|
|
|
echo %%f compile failed
|
|
|
|
goto :END
|
|
|
|
)
|
2023-09-10 14:25:41 -07:00
|
|
|
%%f.exe
|
|
|
|
if errorlevel 1 (
|
|
|
|
echo %%f failed
|
2013-10-19 21:06:55 -07:00
|
|
|
) else (
|
2023-09-10 14:25:41 -07:00
|
|
|
echo %%f ok
|
2013-10-19 21:06:55 -07:00
|
|
|
)
|
|
|
|
)
|
|
|
|
REM Remove temporary files
|
|
|
|
del *.exe *.obj *.res
|
|
|
|
:END
|