Annotation of win32/redis/compile.cmd, revision 1.1
1.1 ! moko 1: @echo off
! 2: REM Builds hiredis (static, no SSL) in 4 variants (Win32/x64 x Release/Debug) with the VS2017 (v141) toolset.
! 3: REM Run it from the unpacked hiredis source directory (see source.url), the results are copied next to this script
! 4:
! 5: set VSDIR=C:\Program Files\Microsoft Visual Studio\18\Community
! 6: set VCVARSALL=%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat
! 7: set CMAKE=%VSDIR%\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe
! 8:
! 9: REM CMakeLists.txt forces /Z7 even for Release, replace it with a harmless flag (Debug gets /Z7 below)
! 10: powershell -NoProfile -Command "(Get-Content CMakeLists.txt -Raw) -replace 'COMPILE_FLAGS /Z7','COMPILE_FLAGS /nologo' | Set-Content CMakeLists.txt -NoNewline"
! 11:
! 12: call :build x86 Release MultiThreaded Release
! 13: call :build x86 Debug MultiThreadedDebug Debug
! 14: call :build amd64 Release MultiThreaded x64\Release
! 15: call :build amd64 Debug MultiThreadedDebug x64\Debug
! 16:
! 17: if not exist "%~dp0include\hiredis" mkdir "%~dp0include\hiredis"
! 18: for %%f in (hiredis.h hiredis_ssl.h read.h sds.h alloc.h) do copy /Y %%f "%~dp0include\hiredis\"
! 19: exit /b 0
! 20:
! 21: :build
! 22: REM %1 - vcvarsall architecture, %2 - configuration, %3 - CMAKE_MSVC_RUNTIME_LIBRARY, %4 - destination (relative to this script)
! 23: setlocal
! 24: call "%VCVARSALL%" %1 -vcvars_ver=14.16 || exit /b 1
! 25: "%CMAKE%" -S . -B build-%1-%2 -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%2 ^
! 26: -DBUILD_SHARED_LIBS=OFF -DDISABLE_TESTS=ON -DENABLE_SSL=OFF -DENABLE_NUGET=OFF ^
! 27: -DCMAKE_MSVC_RUNTIME_LIBRARY=%3 -DCMAKE_C_FLAGS_DEBUG="/Z7 /Ob0 /Od /RTC1" || exit /b 1
! 28: "%CMAKE%" --build build-%1-%2 || exit /b 1
! 29: if "%2"=="Debug" (set LIBNAME=hiredisd.lib) else (set LIBNAME=hiredis.lib)
! 30: if not exist "%~dp0%4" mkdir "%~dp0%4"
! 31: copy /Y build-%1-%2\%LIBNAME% "%~dp0%4\hiredis.lib" || exit /b 1
! 32: endlocal
! 33: exit /b 0
E-mail: