mpromonet / webrtc-streamer

WebRTC streamer for V4L2 capture devices, RTSP sources and Screen Capture
https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/?layout=2x2
The Unlicense
2.8k stars 581 forks source link

Run webrtc-streamer in Debug mode #645

Closed MathewDalle closed 6 months ago

MathewDalle commented 7 months ago

Hi I tried to buildwebrtc-streamer using this script:

@echo off cls set GET_GOOGLE_DEV_ENV=true set GET_DEV_TOOLS=false set CURRENT_PATH=%CD% set REPO_PATH_REVERSE=%CD% set BUILD_TYPE=Release set PLATFORM=x64 set USEVCC=false

for %%a in (%*) do ( if "%%a"=="getdevtools" ( set GET_DEV_TOOLS=true )
if "%%a"=="usevcc" ( set USEVCC=true ) if "%%a"=="debug" ( set BUILD_TYPE=Debug ) if "%%a"=="" ( set "REPO_PATH_REVERSE=%%a" ) )

if %GET_DEV_TOOLS% equ true ( @echo on call PowerShell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SETX PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" call RefreshEnv.cmd call choco install python3 --pre call choco choco install --no-progress -y 7zip git curl sed windows-sdk-11-version-22h2-all call choco install --ignoredetectedreboot --no-progress -y visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --includeRecommended --nocache" call RefreshEnv.cmd @echo off )

set REPO_PATH_REVERSE=%REPO_PATH_REVERSE%\WebRtcTemp

if not exist %REPO_PATH_REVERSE% ( mkdir %REPO_PATH_REVERSE% )

cd %REPO_PATH_REVERSE%

set REPO_PATH=%REPO_PATH_REVERSE:\=/% cd %REPO_PATH_REVERSE%

@echo on :: call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"

@echo off set PATH=%REPO_PATH_REVERSE%\gn\gn_tool\win;%PATH% set PATH=%REPO_PATH_REVERSE%\depot_tools;%PATH% set DEPOT_TOOLS_WIN_TOOLCHAIN=0

if %GET_GOOGLE_DEV_ENV% equ true ( @echo on

if not exist %REPO_PATH_REVERSE%\gn (
    mkdir gn
    cd %REPO_PATH_REVERSE%\gn
    call git clone https://github.com/cpu-chromium/gn_tool      
) else (
    cd %REPO_PATH_REVERSE%\gn\gn_tool
    rmdir gsutil /s/Q
    rmdir linux /s/Q
    rmdir mac /s/Q
    rmdir win /s/Q
    del gsutil.zip /Q
)
cd %REPO_PATH_REVERSE%\gn\gn_tool
call PowerShell.exe -File  bootstrap.ps1
@echo off
set 
@echo on
cd %REPO_PATH_REVERSE%

if not exist %REPO_PATH_REVERSE%\depot_tools (
    mkdir depot_tools
    call git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 
)

if not exist %REPO_PATH_REVERSE%\webrtc (
    mkdir webrtc
    cd %REPO_PATH_REVERSE%\webrtc
    call git clone https://webrtc.googlesource.com/src    
    cd %REPO_PATH_REVERSE%\webrtc\src
    call gclient config https://webrtc.googlesource.com/src

) else (
    cd %REPO_PATH_REVERSE%\webrtc\src
    call gclient config https://webrtc.googlesource.com/src
    call gn clean out/Default
)

if %USEVCC% equ true (

    ::Usa Vs 2019 come compilatore(ancora non va)
    ::call gclient sync --deps=all
    call gclient sync
    call gn gen out/Default --ide="vs2019"
    call autoninja all -C out/Default
    if exist %REPO_PATH_REVERSE%\webrtc\src\out\Default (
        cd %REPO_PATH_REVERSE%\webrtc\src\out\Default
        ::call msbuild all.sln /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM% 
        call msbuild all.sln
    )
) else (
    ::Usa CLang per compilare
    if BUILD_TYPE equ Release (
        call gclient sync
        ::call gn gen out/fuzzers --args="use_libfuzzer=true optimize_for_fuzzing=true"
        call gn gen out/Default --args="is_debug=false"
        ::call gn gen out
        ::call autoninja -C out   
        call autoninja all -C out/Default
    ) else (
        ::call gclient sync --deps=all
        call gclient sync
        ::call gn gen out/Default --args="is_debug=true" --copt=-Z7
        call gn gen out/Default --args="is_debug=true"
        ::call autoninja -C out/Debug 
        call autoninja all -C out/Default
    )        
)

cd %REPO_PATH_REVERSE%

@echo off

)

@echo on

if not exist %REPO_PATH_REVERSE%\webrtc-streamer ( call git clone https://github.com/mpromonet/webrtc-streamer.git cd %REPO_PATH_REVERSE%\webrtc-streamer ) else ( cd %REPO_PATH_REVERSE%\webrtc-streamer call gn clean out/Default ) call gclient config https://github.com/mpromonet/webrtc-streamer.git
call gclient sync

@echo off set WEB_RTC_PATH=%REPO_PATH%/webrtc-streamer set WEB_RTC_PATH_REVERSE=%REPO_PATH_REVERSE%\webrtc-streamer

set PATH=%WEB_RTC_PATH_REVERSE%;%PATH% set PATH=%WEB_RTC_PATH_REVERSE%\src\third_party\llvm-build\Release+Asserts\bin;%PATH% set PATH=%WEB_RTC_PATH_REVERSE%\src\build\toolchain\win\rc\win;%PATH%

if %USEVCC% equ true ( if %BUILD_TYPE% equ Release ( @echo on ::Usa Vs 2019 come compilatore(ancora non va) call cmake -G "Visual Studio 16 2019" -DDETECT_OPENSSL=OFF . ::call msbuild INSTALL.vcxproj /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM% call msbuild INSTALL.vcxproj ) else ( @echo on ::Usa Vs 2019 come compilatore(ancora non va) call cmake -G "Visual Studio 16 2019" -A x64 -DWEBRTCBUILD=DEBUG -DDETECT_OPENSSL=OFF . ::call msbuild INSTALL.vcxproj /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM% call msbuild webrtc-streamer.sln -p:Configuration=Debug ) ) else ( @echo on ::Usa CLang per compilare if %BUILD_TYPE% equ Release ( call cmake Ninja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DWEBRTCROOT="%REPO_PATH%/webrtc" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DDETECT_OPENSSL=OFF -DCMAKE_MAKE_PROGRAM=ninja.bat . ) else ( call cmake -G Ninja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DWEBRTCROOT="%REPO_PATH%/webrtc" -DWEBRTCBUILD=Debug -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_C_FLAGS_DEBUG="/MDt" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_CXX_FLAGS_DEBUG="/MDt" -DDETECT_OPENSSL=OFF -DCMAKE_MAKE_PROGRAM=ninja.bat . ) call ninja )

:fine cd %CURRENT_PATH%

For release version I created the build succesfully, but for build webrtc-strreamer in debug version I encountered error in .gn files or corrupted lib. Can I ask what i wrong ?

mpromonet commented 6 months ago

Hi,

Did you tried with https://github.com/mpromonet/webrtc-streamer/releases/download/v0.8.4/webrtc-streamer-v0.8.4-dirty-Windows-AMD64-Debug.tar.gz ? You may look to https://github.com/mpromonet/webrtc-streamer/blob/master/Dockerfile.windows and https://github.com/mpromonet/webrtc-streamer/blob/master/.github/workflows/cpp-windows.yml

Best Regards, Michel.