Skip to content

Instantly share code, notes, and snippets.

@kwikwag
Created August 22, 2017 22:54
Show Gist options
  • Save kwikwag/c8b715a056b69b5fc07efe05e42187b1 to your computer and use it in GitHub Desktop.
Save kwikwag/c8b715a056b69b5fc07efe05e42187b1 to your computer and use it in GitHub Desktop.
Windows build batch file for Live555, based on instructions by @nspool
@rem Place this file at the live/ directory of the downloaded LIVE555 source files.
@rem Based on instructions at https://nspool.github.io/2016/02/building-live555/
@rem Tested with Visual Studio 2015 on Windows 10
@echo off
if exist "%TEMP%\sed.vbs" goto skip_gen_sed
> "%TEMP%\sed.vbs" (
REM thanks to https://stackoverflow.com/questions/127318/is-there-any-sed-like-utility-for-cmd-exe
@echo.Dim pat, patparts, rxp, inp
@echo.pat = WScript.Arguments(0^)
@echo.patparts = Split(pat,Mid(pat,2,1^)^)
@echo.Set rxp = new RegExp
@echo.rxp.Global = True
@echo.rxp.Multiline = False
@echo.rxp.Pattern = patparts(1^)
@echo.Do While Not WScript.StdIn.AtEndOfStream
@echo. inp = WScript.StdIn.ReadLine(^)
@echo. WScript.Echo rxp.Replace(inp, patparts(2^)^)
@echo.Loop
)
:skip_gen_sed
>nul,where cl && goto skip_vsvars
call "%VS140COMNTOOLS%\vsvars32.bat"
:skip_vsvars
if exist win32config.orig goto skip_win32config
cscript //NoLogo %TEMP%\sed.vbs "s/(^TOOLS32.*$)/TOOLS32 = %VCINSTALLDIR:~0,-1%/" < win32config | ^
cscript //NoLogo %TEMP%\sed.vbs "s|(-out)|/out|" | ^
cscript //NoLogo %TEMP%\sed.vbs "s/(^!include)/#!include/" | ^
cscript //NoLogo %TEMP%\sed.vbs "s|(\$\(link\))|link ws2_32.lib|" | ^
cscript //NoLogo %TEMP%\sed.vbs "s/(msvcirt.lib)/msvcrt.lib/" > win32config.new
>nul,move win32config win32config.orig
>nul,move win32config.new win32config
:skip_win32config
call genWindowsMakefiles
cd liveMedia
del *.obj *.lib
nmake /B -f liveMedia.mak
cd ..\groupsock
del *.obj *.lib
nmake /B -f groupsock.mak
cd ..\UsageEnvironment
del *.obj *.lib
nmake /B -f UsageEnvironment.mak
cd ..\BasicUsageEnvironment
del *.obj *.lib
nmake /B -f BasicUsageEnvironment.mak
cd ..\testProgs
del *.obj *.lib
nmake /B -f testProgs.mak
cd ..\mediaServer
del *.obj *.lib
nmake /B -f mediaServer.mak
cd ..
@Alessandro-Maf
Copy link

Hello! This post has been of enormous help for me!

I adapted the script to Visual Studio 2017 Professional. This has to be copied in the \live directory


powershell -Command "(gc win32config) -replace '!include    <ntwin32.mak>', '#!include    <ntwin32.mak>' | Out-File win32config"
powershell -Command "(gc win32config) -replace 'c:\\Program Files\\DevStudio\\Vc', 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023' | Out-File win32config"
powershell -Command "(gc win32config) -replace '\(TOOLS32\)\\bin\\cl', '(TOOLS32)\bin\HostX86\x64\cl' | Out-File win32config"
powershell -Command "(gc win32config) -replace 'LINK =			\$\(link\) -out:', 'LINK = link ws2_32.lib /out:' | Out-File win32config"
powershell -Command "(gc win32config) -replace 'LIBRARY_LINK =		lib -out:', 'LIBRARY_LINK = lib /out:' | Out-File win32config"
powershell -Command "(gc win32config) -replace 'msvcirt.lib', 'msvcrt.lib' | Out-File win32config"

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\vsdevcmd" -arch=x64


call genWindowsMakefiles

cd liveMedia
del *.obj *.lib
nmake /B -f liveMedia.mak
cd ..\groupsock
del *.obj *.lib
nmake /B -f groupsock.mak
cd ..\UsageEnvironment
del *.obj *.lib
nmake /B -f UsageEnvironment.mak
cd ..\BasicUsageEnvironment
del *.obj *.lib
nmake /B -f BasicUsageEnvironment.mak
cd ..\testProgs
del *.obj *.lib *.exe
nmake /B -f testProgs.mak
cd ..\mediaServer
del *.obj *.lib *.exe
nmake /B -f mediaServer.mak
cd ..\proxyServer
del *.obj *.lib *.exe
nmake /B -f proxyServer.mak
cd ..\hlsProxy
del *.obj *.lib *.exe
nmake /B -f hlsProxy.mak
cd ..
pause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment