1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 04:25:10 -07:00
libsodium/test/default/wintest.bat
Niyas Sait 13144d11c1
Enable building win/arm64 package using visual studio (#1130)
* Retarget Visual studio tool chain to v142

* add ARM64 option to wintest.bat

* add windows/arm64 target to appveyor for CI

* add arm64 targets to visual studio solutions

* add cross compile option to wintest.bat

* Fix missing SET in wintest.bat

* update auto-generation scripts for msvc and update project files
2021-11-18 00:43:23 +01:00

62 lines
1.5 KiB
Batchfile
Executable File

@ECHO OFF
if "%1" == "" (
echo "Usage: wintest.bat <Release | ReleaseDLL | Debug | DebugDLL> [ <x64 | ARM64> ]"
goto :END
)
if not exist sodium_version.c (
CD test\default
if not exist sodium_version.c (
echo "Are you on the right path?" %CD%
goto :END
)
)
if "%2" == "x64" (SET ARCH=x64) else if "%2" == "ARM64" (SET ARCH=ARM64) else (SET ARCH=ARM64)
if "%2" == "ARM64" (SET CROSSCOMPILE=1) else (SET CROSSCOMPILE=0)
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
echo Running the test suite:
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
)
if %CROSSCOMPILE% == 1 (
echo %%f skipped
) else (
%%f.exe
if errorlevel 1 (
echo %%f failed
) else (
echo %%f ok
)
)
)
REM Remove temporary files
del *.exe *.obj *.res
:END