feat: Windows FFI build tooling + livekit_ffi.dll/pdb with symbols - #70
Merged
Merged
Conversation
🔗 Merge Alignment ReminderIf this PR targets Both repos should be merged in coordination to avoid breaking changes. Do not merge one without the other being ready. |
NickKhalow
approved these changes
Jun 24, 2026
NickKhalow
requested changes
Jun 25, 2026
alejandro-jimenez-dcl
force-pushed
the
feat/windows-ffi-build-tooling
branch
2 times, most recently
from
June 25, 2026 17:35
80de493 to
2056452
Compare
NickKhalow
approved these changes
Jun 26, 2026
4 tasks
docs: drop regex comparison and script-side Patch.toml flag explanations Address PR review: - remove the redundant 'unlike a regex' / 'rather than a fragile regex' note - stop explaining Patch.toml's flags in build-win.py; point to Patch.toml, which is the single source for them (also fix its stale build-win.ps1 ref) refactor: port Windows FFI build script to Python The reviewer pushed back on shelling out to cmd for the dasel patch step. Root cause was Windows PowerShell 5.1 stdin handling: dasel v3 reads its input only from a real file handle, which PS 5.1 cannot provide without cmd (no `<` operator, and pipes / RedirectStandardInput deliver nothing to it). Porting the build to Python sidesteps this: subprocess hands dasel the open Cargo.toml as stdin (a real fd), so no shell redirect is needed. - build-win.py replaces build-win.ps1; reads build.config.toml via stdlib tomllib instead of build.config.psd1. - env-setup.ps1 stays in PowerShell (bootstrap for a bare machine) and now installs Python 3 too, since build-win.py runs on it. - The one remaining cmd call sources vcvarsall.bat (a batch file) - no native alternative, and unrelated to the dasel stdin issue. - Docs: BUILD-WINDOWS.md updated for the Python flow, with a clearer MAX_PATH (260) long-path note + troubleshooting row (webrtc headers nest to ~390 chars; use a short SourceDir like C:/src, or enable LongPathsEnabled). Verified end-to-end: built livekit_ffi.dll + .pdb from C:/src (exit 0, valid x64 PE with paired PDB). fix: address PR review - pin toolchain versions, fix dasel stdin Review feedback on the Windows FFI build tooling: - env-setup.ps1: pin protoc (35.1) and dasel (v3.11.1) instead of pulling "latest". "latest" had silently moved dasel v2 -> v3, whose selector syntax differs and broke build-win.ps1; pinning makes the build reproducible and removes the supply-chain risk. - build-win.ps1: feed dasel via `cmd /c "... < file"` input redirection instead of a `type ... |` pipe. dasel v3 on Windows only reads stdin from an OS file-handle redirect; pipes (pwsh, cmd, .NET stdin) deliver nothing, so the old pipe path never actually patched the profile. - build-win.ps1: rename cargoToml/patchToml vars to *Path to disambiguate path from content. - Patch.toml: make it the single source for the profile flags; annotate each flag with its purpose. - BUILD-WINDOWS.md: drop the redundant "(via dasel)" note and the duplicated flag list, point at Patch.toml instead. fix: add livekit_ffi.pdb.meta so Unity imports the debug symbols refactor: patch [profile.release] via dasel + Patch.toml Replace the regex rewrite of the downloaded Cargo.toml's [profile.release] with a dasel overlay (proper TOML parsing instead of fragile pattern matching), per code review. - Patch.toml: the [profile.release] to overlay (mirrors upstream rust-sdks' own release profile); edit here to change build flags - build-win.ps1: apply Patch.toml with dasel, routed through cmd so the stdin pipe works across PowerShell versions; resolve dasel from PATH or env-setup's copy and fail loudly if a tag defines no [profile.release] - env-setup.ps1: download dasel to %LOCALAPPDATA%\dasel - build.config.psd1: add a header explaining how to use the config - BUILD-WINDOWS.md: document Patch.toml, dasel, and related troubleshooting Verified end to end: dasel patches Cargo.toml to the exact profile and the livekit-ffi release build (DLL + PDB) completes. feat: Windows FFI build tooling + livekit_ffi.dll/pdb with symbols Add BuildScripts~/windows, a config-driven tool to build livekit_ffi.dll plus matching livekit_ffi.pdb on Windows (x86_64-pc-windows-msvc): - build.config.psd1: Tag, SourceDir, InstallToPlugins, CleanSourceAfterBuild - env-setup.ps1: one-time toolchain install (VS2022 + Win11 SDK, Git, Rust, libclang, protoc); checks Python is present - build-win.ps1: downloads the rust-sdks source for the tag into a gitignored clone dir, patches [profile.release] for PDB output, builds livekit-ffi, and places the DLL + PDB per config - BUILD-WINDOWS.md: usage, config reference, troubleshooting The folder lives under BuildScripts~ so Unity ignores it; the downloaded source and any staged binaries are gitignored. Also updates the shipped Windows DLL and adds its PDB for symbolication, tracked via Git LFS (adds *.pdb to .gitattributes).
alejandro-jimenez-dcl
force-pushed
the
feat/windows-ffi-build-tooling
branch
from
June 29, 2026 10:33
55d3333 to
8cec6a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add BuildScripts~/windows, a config-driven tool to build livekit_ffi.dll plus matching livekit_ffi.pdb on Windows (x86_64-pc-windows-msvc):
The folder lives under BuildScripts~ so Unity ignores it; the downloaded source and any staged binaries are gitignored. Also updates the shipped Windows DLL and adds its PDB for symbolication, tracked via Git LFS (adds *.pdb to .gitattributes).
Configuring build.config.psd1
This is the settings file for the Windows FFI build (build-win.ps1). It's a PowerShell data file: keep the @{ ... } wrapper, don't rename keys, use single-quoted strings and $true/$false for booleans.
Steps:
(First time only: run .\env-setup.ps1 once to install the toolchain.)
Settings:
Typical flow: bump Tag to the version you need, leave InstallToPlugins = $true, run .\build-win.ps1, commit the updated DLL/PDB.