Files
obs-soundwave/scripts/gen-obs-libs.ps1
T
2026-11-12 21:00:55 +08:00

27 lines
1.1 KiB
PowerShell

param(
[string]$ObsPath = "C:\Program Files\obs-studio",
[string]$OutDir = "D:\dsh-build\obs-libs",
[string]$VsPath = "D:\VS\BuildTools"
)
$ErrorActionPreference = "Stop"
$root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$vcvars = Join-Path $VsPath "VC\Auxiliary\Build\vcvars64.bat"
$obsBin = Join-Path $ObsPath "bin\64bit"
if (-not (Test-Path $vcvars)) { throw "vcvars64.bat not found: $vcvars" }
if (-not (Test-Path (Join-Path $obsBin "obs.dll"))) { throw "obs.dll not found in $obsBin" }
New-Item -ItemType Directory -Force $OutDir | Out-Null
python (Join-Path $root "tools\gen_obs_def.py") (Join-Path $obsBin "obs.dll") (Join-Path $OutDir "obs.def")
python (Join-Path $root "tools\gen_obs_def.py") (Join-Path $obsBin "obs-frontend-api.dll") (Join-Path $OutDir "obs-frontend-api.def")
$cmd = 'call "{0}" >nul && cd /d "{1}" && lib /def:obs.def /machine:x64 /out:obs.lib && lib /def:obs-frontend-api.def /machine:x64 /out:obs-frontend-api.lib' -f `
$vcvars, $OutDir
cmd.exe /c $cmd
if ($LASTEXITCODE -ne 0) { throw "Import library generation failed" }
Write-Host "Generated: $OutDir\obs.lib, $OutDir\obs-frontend-api.lib"