vulcast-vertical/build-vulcast-vertical.ps1
Vulcast 1496c4a75d
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run
Fix: let cmake handle all deps, update to OBS 31.1.1 + deps 2025-07-11
2026-06-29 23:57:05 +01:00

107 lines
4.2 KiB
PowerShell

#Requires -Version 7.2
<#
.SYNOPSIS
Builds the Vulcast Vertical OBS plugin DLL.
CMake handles all dependency downloads and OBS builds automatically.
Re-run to rebuild only (deps are cached by cmake).
#>
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$WORK = "$env:TEMP\vulcast-build"
$SRC = "$WORK\vulcast-vertical"
Write-Host "=== Vulcast Vertical Build Script ===" -ForegroundColor Cyan
Write-Host ""
# ---------- Build Tools ----------
function Find-MSVC {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vsWhere) {
$p = & $vsWhere -latest -property installationPath 2>$null
if ($p) { return $p }
}
foreach ($v in '2022','2019') {
foreach ($ed in 'BuildTools','Community','Professional','Enterprise') {
foreach ($base in "${env:ProgramFiles(x86)}","${env:ProgramFiles}") {
$p = "$base\Microsoft Visual Studio\$v\$ed"
if (Test-Path "$p\VC\Auxiliary\Build\vcvarsall.bat") { return $p }
}
}
}
return $null
}
$vsPath = Find-MSVC
if (-not $vsPath) {
Write-Host "Installing VS 2022 Build Tools (~3GB, 5-15 min)..." -ForegroundColor Yellow
$installer = "$env:TEMP\vs_buildtools.exe"
if (-not (Test-Path $installer)) {
Invoke-WebRequest -Uri 'https://aka.ms/vs/17/release/vs_BuildTools.exe' -OutFile $installer
}
$proc = Start-Process -FilePath $installer -ArgumentList @(
'--quiet','--wait','--norestart',
'--add','Microsoft.VisualStudio.Workload.VCTools',
'--add','Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
'--add','Microsoft.VisualStudio.Component.Windows11SDK.22621',
'--includeRecommended'
) -Wait -PassThru
if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) {
Write-Error "Install failed. Get it from https://visualstudio.microsoft.com/downloads/"
exit 1
}
$vsPath = Find-MSVC
if (-not $vsPath) {
Write-Error "Installed but not found. Restart terminal and run again."
exit 1
}
Write-Host "[OK] Installed: $vsPath`n" -ForegroundColor Green
} else {
Write-Host "[OK] Build Tools: $vsPath`n" -ForegroundColor Green
}
$vcvars = Get-ChildItem -Path $vsPath -Recurse -Filter 'vcvarsall.bat' -ErrorAction SilentlyContinue |
Select-Object -First 1 -ExpandProperty FullName
if (-not $vcvars) { Write-Error "vcvarsall.bat not found"; exit 1 }
Write-Host "Setting up MSVC x64..." -ForegroundColor Yellow
cmd /c "`"$vcvars`" x64 >nul 2>&1 && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
[System.Environment]::SetEnvironmentVariable($Matches[1], $Matches[2])
}
}
if (Get-Command cl.exe -ErrorAction SilentlyContinue) { Write-Host "[OK] cl.exe ready`n" -ForegroundColor Green }
# ---------- Download source (skip if exists) ----------
New-Item -ItemType Directory -Path $WORK -Force | Out-Null
if (-not (Test-Path "$SRC\CMakeLists.txt")) {
Write-Host "Downloading source..." -ForegroundColor Yellow
Invoke-WebRequest -Uri 'https://vulcast.xyz/dl/vulcast-vertical-source.zip' -OutFile "$WORK\source.zip"
Expand-Archive -Path "$WORK\source.zip" -DestinationPath $WORK -Force
Write-Host ""
}
# ---------- Build (cmake handles all deps automatically) ----------
Write-Host "Configuring plugin (cmake downloads OBS + deps on first run)..." -ForegroundColor Yellow
Push-Location $SRC
cmake -S . -B build `
-G "Visual Studio 17 2022" -A x64 `
-DBUILD_OUT_OF_TREE=On `
-DCMAKE_BUILD_TYPE=Release 2>&1 | Write-Host
Write-Host "`nBuilding..." -ForegroundColor Yellow
cmake --build build --config Release -- /m /noLogo 2>&1 | Write-Host
Pop-Location
# ---------- Done ----------
$dll = Get-ChildItem -Path "$SRC\build" -Recurse -Filter "vulcast-vertical.dll" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($dll) {
$dest = "$env:USERPROFILE\Desktop\vulcast-vertical.dll"
Copy-Item $dll.FullName $dest -Force
Write-Host "`n=== BUILD SUCCESSFUL ===" -ForegroundColor Green
Write-Host "DLL: $dest" -ForegroundColor Green
Write-Host "`nInstall: copy to `"C:\Program Files\obs-studio\obs-plugins\64bit\`" and restart OBS."
} else {
Write-Error "DLL not found. Check output above."
}