You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3 KiB

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