55 workflow_dispatch :
66 inputs :
77 webrtc_commit :
8- description : ' Specify WebRTC commit to build .'
8+ description : ' WebRTC src commit (full or short) .'
99 required : false
10- default : ' 60e674842ebae283cc6b2627f4b6f2f8186f3317 ' # Date: Wed Apr 7 19:12:13 2021 +0200
10+ default : ' e8b4d4c5952a8fb7b35c2a6cba4e8c3de2ea2e1e '
1111 depot_tools_commit :
12- description : ' Specify Depot Tools commit to to use for the build .'
12+ description : ' depot_tools commit (override pin in webrtc_build.sh) .'
1313 required : false
14- default : ' e1a98941d3ab10549be6d82d0686bb0fb91ec903 ' # Date: Wed Apr 7 21:35:29 2021 +0000
14+ default : ' 10eda50a3fd9c34ad8d31ec74e5f4eb5823d60f6 '
1515
1616concurrency :
1717 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -20,29 +20,35 @@ concurrency:
2020env :
2121 WEBRTC_COMMIT : ${{ github.event.inputs.webrtc_commit }}
2222 DEPOT_TOOLS_COMMIT : ${{ github.event.inputs.depot_tools_commit }}
23+ WEBRTC_WORK_ROOT : ${{ github.workspace }}/..
24+ GCLIENT_JOBS : 8
2325
2426jobs :
2527
2628 Unix :
2729 permissions :
28- contents : write # upload
30+ contents : read
2931 runs-on : ${{ matrix.os }}
3032 strategy :
3133 fail-fast : false
3234 matrix :
33- os : [ubuntu-22.04, macos-13]
35+ include :
36+ - os : ubuntu-22.04
37+ package_suffix : linux_cxx-abi-1
38+ - os : macos-14
39+ package_suffix : macos_arm64
3440
3541 steps :
3642 - name : Checkout source code
3743 uses : actions/checkout@v4
3844
39- - name : Set up Python version
45+ - name : Set up Python
4046 uses : actions/setup-python@v5
4147 with :
42- python-version : 3.10
48+ python-version : ' 3.10'
4349
44- - name : Install dependencies
45- if : ${{ matrix.os == 'ubuntu-22.04' }}
50+ - name : Install dependencies (Ubuntu)
51+ if : matrix.os == 'ubuntu-22.04'
4652 run : |
4753 source 3rdparty/webrtc/webrtc_build.sh
4854 install_dependencies_ubuntu
@@ -60,116 +66,117 @@ jobs:
6066 - name : Upload WebRTC
6167 uses : actions/upload-artifact@v4
6268 with :
63- name : webrtc_release_ ${{ matrix.os }}
69+ name : webrtc_ ${{ matrix.package_suffix }}
6470 path : |
65- webrtc_*.tar.gz
66- checksum_*.txt
71+ webrtc_*.tar.gz
72+ checksum_webrtc_*.tar.gz
6773 if-no-files-found : error
6874
6975 Windows :
7076 permissions :
71- contents : write # upload
72- # https://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows_build_instructions.md
77+ contents : read
7378 runs-on : windows-2022
79+ strategy :
80+ fail-fast : false
81+ matrix :
82+ include :
83+ - config : Release
84+ static_runtime : ON
85+ tag : Release_mt
86+ - config : Release
87+ static_runtime : OFF
88+ tag : Release_md
89+ - config : Debug
90+ static_runtime : ON
91+ tag : Debug_mt
92+ - config : Debug
93+ static_runtime : OFF
94+ tag : Debug_md
7495 env :
75- WORK_DIR : " C:\\ WebRTC" # Not enough space in D:
76- OPEN3D_DIR : " D: \\ a \\ open3d \\ open3d "
77- DEPOT_TOOLS_UPDATE : 1 # Fix cannot find python3_bin_reldir.txt
78- DEPOT_TOOLS_WIN_TOOLCHAIN : 0
79- NPROC : 2
96+ WORK_DIR : ' C:\WebRTC'
97+ OPEN3D_DIR : ${{ github.workspace }}
98+ WEBRTC_WORK_ROOT : ' C:\WebRTC '
99+ DEPOT_TOOLS_UPDATE : 0 # belt-and-suspenders; also set by webrtc_setup_path
100+ DEPOT_TOOLS_WIN_TOOLCHAIN : 0 # use locally installed VS, not the Chromium toolchain
80101
81102 steps :
82103 - name : Checkout source code
83104 uses : actions/checkout@v4
84105
85- - name : Set up Python version
106+ - name : Set up Python
86107 uses : actions/setup-python@v5
87108 with :
88109 python-version : ' 3.10'
89110
90- - name : Disk space
111+ - name : Prepare work directory
112+ shell : pwsh
91113 run : |
92114 Get-PSDrive
93- mkdir " $env:WORK_DIR"
115+ New-Item -ItemType Directory -Force -Path $env:WORK_DIR
94116
95- - name : Setup PATH for Visual Studio # Required for Ninja
117+ - name : Setup PATH for Visual Studio
96118 uses : ilammy/msvc-dev-cmd@v1
97119 with :
98120 arch : x64
99121
100122 - name : Download WebRTC sources
101- shell : pwsh
102- working-directory : ${{ env.WORK_DIR }}
123+ shell : bash # Git Bash transparently converts Windows-style env paths
103124 run : |
104- $ErrorActionPreference = 'Stop'
105- echo "Get depot_tools"
106- # Checkout to a specific version
107- # Ref: https://chromium.googlesource.com/chromium/src/+/main/docs/building_old_revisions.md
108- git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
109- git -C depot_tools checkout $env:DEPOT_TOOLS_COMMIT
110- $env:Path = (Get-Item depot_tools).FullName + ";" + $env:Path
111-
112- echo "Get WebRTC"
113- mkdir webrtc
114- cd webrtc
115- fetch webrtc
116-
117- git -C src checkout $env:WEBRTC_COMMIT
118- git -C src submodule update --init --recursive
119- echo "gclient sync"
120- gclient sync -D --force --reset
121- cd ..
122- echo "random.org"
123- curl "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" -o skipcache
125+ source "$OPEN3D_DIR/3rdparty/webrtc/webrtc_build.sh"
126+ download_webrtc_sources
124127
125128 - name : Patch WebRTC
129+ shell : pwsh
126130 working-directory : ${{ env.WORK_DIR }}
127131 run : |
128132 $ErrorActionPreference = 'Stop'
129- cp "$env:OPEN3D_DIR/3rdparty/webrtc/CMakeLists.txt" webrtc/
130- cp "$env:OPEN3D_DIR/3rdparty/webrtc/webrtc_common.cmake" webrtc/
131-
132- - name : Build WebRTC (Release)
133- working-directory : ${{ env.WORK_DIR }}
134- run : |
135- $ErrorActionPreference = 'Stop'
136- $env:Path = (Get-Item depot_tools).FullName + ";" + $env:Path
137- mkdir webrtc/build
138- cd webrtc/build
139- cmake -G Ninja -D CMAKE_BUILD_TYPE=Release `
140- -D CMAKE_INSTALL_PREFIX=${{ env.WORK_DIR }}/webrtc_release/Release `
141- ..
142- ninja install
143- echo "Cleanup build folder for next config build"
144- cd ..
145- rm -r build
133+ Copy-Item "$env:OPEN3D_DIR/3rdparty/webrtc/CMakeLists.txt" webrtc/
134+ Copy-Item "$env:OPEN3D_DIR/3rdparty/webrtc/webrtc_common.cmake" webrtc/
135+ bash "$env:OPEN3D_DIR/3rdparty/webrtc/apply_webrtc_patches.sh" `
136+ "$env:OPEN3D_DIR" "$env:WORK_DIR/webrtc/src"
146137
147- - name : Build WebRTC (Debug)
138+ - name : Build and package WebRTC
139+ shell : pwsh
148140 working-directory : ${{ env.WORK_DIR }}
141+ env :
142+ BUILD_CONFIG : ${{ matrix.config }}
143+ STATIC_RT : ${{ matrix.static_runtime }}
144+ WIN_TAG : ${{ matrix.tag }}
149145 run : |
150146 $ErrorActionPreference = 'Stop'
151- $env:Path = (Get-Item depot_tools).FullName + ";" + $env:Path
152- mkdir webrtc/build
153- cd webrtc/build
154- cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug `
155- -D CMAKE_INSTALL_PREFIX=${{ env.WORK_DIR }}/webrtc_release/Debug `
156- ..
147+ # Locate the VS-installed ninja.exe *before* prepending depot_tools to
148+ # PATH. depot_tools contains a Unix wrapper script named 'ninja' (no
149+ # extension) that Windows cannot execute; if depot_tools appears first
150+ # in PATH cmake -G Ninja picks up that script and fails with
151+ # "unknown error" when trying to run 'ninja --version'.
152+ $ninjaExe = (Get-Command ninja.exe -ErrorAction Stop).Source
153+ $env:Path = (Get-Item depot_tools).FullName + ';' + $env:Path
154+ $installRoot = Join-Path $env:WORK_DIR "webrtc_pkg"
155+ if (Test-Path $installRoot) { Remove-Item -Recurse -Force $installRoot }
156+ New-Item -ItemType Directory -Force -Path webrtc/build | Out-Null
157+ Push-Location webrtc/build
158+ $debugFlag = if ($env:BUILD_CONFIG -eq 'Debug') { 'ON' } else { 'OFF' }
159+ cmake -G Ninja `
160+ -D CMAKE_MAKE_PROGRAM="$ninjaExe" `
161+ -D CMAKE_BUILD_TYPE=$env:BUILD_CONFIG `
162+ -D WEBRTC_IS_DEBUG=$debugFlag `
163+ -D WEBRTC_STATIC_MSVC_RUNTIME=$env:STATIC_RT `
164+ -D CMAKE_INSTALL_PREFIX=$installRoot `
165+ ..
157166 ninja install
158-
159- - name : Package WebRTC
160- working-directory : ${{ env.WORK_DIR }}
161- run : |
162- $ErrorActionPreference = 'Stop'
163- $env:WEBRTC_COMMIT_SHORT = (git -C webrtc/src rev-parse --short=7 HEAD)
164- cmake -E tar cv webrtc_${env:WEBRTC_COMMIT_SHORT}_win.zip `
165- --format=zip -- webrtc_release
166- cmake -E sha256sum webrtc_${env:WEBRTC_COMMIT_SHORT}_win.zip | Tee-Object -FilePath checksum_win.txt
167+ Pop-Location
168+ $short = (git -C webrtc/src rev-parse --short=7 HEAD)
169+ $zip = "webrtc_${short}_win_$env:WIN_TAG.zip"
170+ Push-Location $installRoot
171+ cmake -E tar cvf (Join-Path $env:OPEN3D_DIR $zip) --format=zip .
172+ Pop-Location
173+ cmake -E sha256sum (Join-Path $env:OPEN3D_DIR $zip) | Tee-Object -FilePath (Join-Path $env:OPEN3D_DIR "checksum_$zip")
167174
168175 - name : Upload WebRTC
169176 uses : actions/upload-artifact@v4
170177 with :
171- name : webrtc_release_windows
178+ name : webrtc_win_${{ matrix.tag }}
172179 path : |
173- ${{ env.WORK_DIR }}/ webrtc_*.zip
174- ${{ env.WORK_DIR }}/checksum_*.txt
180+ webrtc_*_win_ *.zip
181+ checksum_webrtc_*_win_*.zip
175182 if-no-files-found : error
0 commit comments