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.

78 lines
1.8 KiB

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