Files
punktfunk/scripts/windows/setup-build-env.ps1
T
enricobuehler 01fcb01019 fix(encode/windows): resolve NVENC at runtime — AMD/Intel hosts no longer crash at start
The nvenc build linked nvEncodeAPI64.dll's entry points at load time, so a
--features nvenc binary hard-crashed on any box without the NVIDIA driver
(AMD/Intel). Entry points now come from a runtime LoadLibrary table
(encode/windows/nvenc.rs load_api); a missing DLL just falls through the
encoder auto-detect to AMF/QSV/software. The generated import lib and all its
plumbing (gen-nvenc-importlib.ps1, nvenc.def, PUNKTFUNK_NVENC_LIB_DIR,
setup-build-env wiring) are gone.

Live-validated on the RTX 4090 box (NVENC session, 7000+ frames).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 12:09:18 +00:00

28 lines
1.3 KiB
PowerShell

<#
Persist the punktfunk Windows-host build environment (Machine scope, run once, elevated).
After this, deploy-host.ps1 needs only the VS toolchain (it loads vcvars64.bat itself).
These are BUILD-time vars; runtime config lives in C:\ProgramData\punktfunk\host.env.
powershell -ExecutionPolicy Bypass -File scripts\windows\setup-build-env.ps1
#>
$ErrorActionPreference = 'Stop'
$admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if (-not $admin) { throw "Run elevated (Machine-scope env requires Administrator)." }
# libclang for bindgen; cmake policy floor for audiopus_sys. (NVENC needs no build-time env:
# its entry points are runtime-loaded from the driver's nvEncodeAPI64.dll.)
$vars = [ordered]@{
'LIBCLANG_PATH' = 'C:\Program Files\LLVM\bin'
'CMAKE_POLICY_VERSION_MINIMUM' = '3.5'
# FFMPEG_DIR is only needed for the `amf-qsv` feature (libavcodec). The RTX box builds
# `--features nvenc`, which does NOT link FFmpeg, so it is intentionally left unset.
}
foreach ($k in $vars.Keys) {
[Environment]::SetEnvironmentVariable($k, $vars[$k], 'Machine')
Write-Host ("set (Machine) {0} = {1}" -f $k, $vars[$k])
}
Write-Host "Done. Open a fresh shell (or reboot) for these to be inherited by new processes."