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

43 lines
1.6 KiB
PowerShell

param(
[string]$ObsSource = "D:\dsh-build\obs-studio-33",
[string]$ObsLibs = "D:\dsh-build\obs-libs",
[string]$QtRoot = "D:\Qt\6.10.3\msvc2022_64",
[string]$VsPath = "D:\VS\BuildTools",
[string]$BuildDir = ""
)
$ErrorActionPreference = "Stop"
$root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
if ([string]::IsNullOrEmpty($BuildDir)) {
$BuildDir = Join-Path $root "build"
}
$vcvars = Join-Path $VsPath "VC\Auxiliary\Build\vcvars64.bat"
if (-not (Test-Path $vcvars)) {
throw "vcvars64.bat not found at '$vcvars'. Set -VsPath to your Visual Studio Build Tools installation."
}
if (-not (Test-Path (Join-Path $QtRoot "lib\cmake\Qt6\Qt6Config.cmake"))) {
throw "Qt6 CMake package not found under '$QtRoot'. Set -QtRoot to your Qt 6 MSVC 2022 x64 installation."
}
if (-not (Test-Path (Join-Path $ObsSource "libobs\obs.h"))) {
throw "obs-studio headers not found under '$ObsSource'. Set -ObsSource to an obs-studio source tree matching the installed OBS version."
}
if (-not (Test-Path (Join-Path $ObsLibs "obs.lib"))) {
throw "obs.lib not found in '$ObsLibs'. Run scripts/gen-obs-libs.ps1 first."
}
$cmd = ('call "{0}" >nul && cmake -S "{1}" -B "{2}" -G Ninja -DCMAKE_BUILD_TYPE=Release ' +
'-DCMAKE_PREFIX_PATH="{3}" -DOBS_SOURCE_DIR="{4}" -DOBS_LIB_DIR="{5}" && cmake --build "{2}" --parallel') -f `
$vcvars, $root, $BuildDir, $QtRoot, $ObsSource, $ObsLibs
Write-Host $cmd
cmd.exe /c $cmd
if ($LASTEXITCODE -ne 0) {
throw "Build failed with exit code $LASTEXITCODE"
}
$dll = Join-Path $BuildDir "bin\audio-waveform-dock.dll"
Write-Host ""
Write-Host "Built: $dll"