diff --git a/build-vulcast-vertical.ps1 b/build-vulcast-vertical.ps1 index 4efd7e2..099fbf5 100644 --- a/build-vulcast-vertical.ps1 +++ b/build-vulcast-vertical.ps1 @@ -2,12 +2,11 @@ <# .SYNOPSIS Downloads and builds the Vulcast Vertical OBS plugin DLL. - Auto-installs VS Build Tools if needed. Skips downloads if already cached. + Skips downloads if already cached. Re-run to rebuild only. #> $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' -# Bump these when OBS updates $OBS_VERSION = '32.1.2' $DEPS_DATE = '2026-06-25' @@ -15,10 +14,9 @@ $WORK = "$env:TEMP\vulcast-build" $SRC = "$WORK\vulcast-vertical" Write-Host "=== Vulcast Vertical Build Script ===" -ForegroundColor Cyan -Write-Host "OBS $OBS_VERSION | Deps $DEPS_DATE" -Write-Host "" +Write-Host "OBS $OBS_VERSION | Deps $DEPS_DATE`n" -# ---------- Check / Install Build Tools ---------- +# ---------- Build Tools ---------- function Find-MSVC { $vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" if (Test-Path $vsWhere) { @@ -27,10 +25,10 @@ function Find-MSVC { } foreach ($v in '2022','2019') { foreach ($ed in 'BuildTools','Community','Professional','Enterprise') { - $p = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\$v\$ed" - if (Test-Path "$p\VC\Auxiliary\Build\vcvarsall.bat") { return $p } - $p = "${env:ProgramFiles}\Microsoft Visual Studio\$v\$ed" - if (Test-Path "$p\VC\Auxiliary\Build\vcvarsall.bat") { return $p } + 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 @@ -38,35 +36,30 @@ function Find-MSVC { $vsPath = Find-MSVC if (-not $vsPath) { - Write-Host "C++ Build Tools not found. Installing VS 2022 Build Tools..." -ForegroundColor Yellow - Write-Host "(Downloads ~3GB, takes 5-15 minutes)" -ForegroundColor Yellow - + 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', + '--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 "Build Tools install failed (exit $($proc.ExitCode)). Install manually: https://visualstudio.microsoft.com/downloads/" + Write-Error "Install failed (exit $($proc.ExitCode)). Install manually from https://visualstudio.microsoft.com/downloads/" exit 1 } - $vsPath = Find-MSVC if (-not $vsPath) { - Write-Error "Installed but not detected. Restart terminal and run again." + Write-Error "Installed but not found. Restart terminal and run again." exit 1 } - Write-Host "[OK] Build Tools installed: $vsPath" -ForegroundColor Green + Write-Host "[OK] Installed: $vsPath`n" -ForegroundColor Green } else { - Write-Host "[OK] Build Tools: $vsPath" -ForegroundColor Green + Write-Host "[OK] Build Tools: $vsPath`n" -ForegroundColor Green } $vcvars = Get-ChildItem -Path $vsPath -Recurse -Filter 'vcvarsall.bat' -ErrorAction SilentlyContinue | @@ -79,73 +72,67 @@ cmd /c "`"$vcvars`" x64 >nul 2>&1 && set" | ForEach-Object { [System.Environment]::SetEnvironmentVariable($Matches[1], $Matches[2]) } } +if (Get-Command cl.exe -ErrorAction SilentlyContinue) { Write-Host "[OK] cl.exe ready`n" -ForegroundColor Green } -$cl = Get-Command cl.exe -ErrorAction SilentlyContinue -if ($cl) { Write-Host "[OK] Compiler: $($cl.Source)" -ForegroundColor Green } +# ---------- Create work dir (no cleanup) ---------- +New-Item -ItemType Directory -Path $WORK -Force | Out-Null -# ---------- Download helper (skip if cached) ---------- -function Get-IfMissing { - param([string]$Url, [string]$Path, [string]$Label) - if (Test-Path $Path) { - Write-Host " $Label (cached)" -ForegroundColor DarkGray - return - } - Write-Host " $Label..." -ForegroundColor Yellow +# ---------- Download helper ---------- +function Get-IfMissing($Url, $Path, $Label) { + if (Test-Path $Path) { Write-Host " $Label (cached)" -ForegroundColor DarkGray; return } + Write-Host " $Label downloading..." -ForegroundColor Yellow Invoke-WebRequest -Uri $Url -OutFile $Path } # ---------- Step 1: Source ---------- -Write-Host "`n[1/5] Source code" -ForegroundColor Cyan -New-Item -ItemType Directory -Path $WORK -Force | Out-Null +Write-Host "[1/5] Source code" -ForegroundColor Cyan Get-IfMissing 'https://vulcast.xyz/dl/vulcast-vertical-source.zip' "$WORK\source.zip" "vulcast-vertical" -if (-not (Test-Path $SRC)) { +if (-not (Test-Path "$SRC\CMakeLists.txt")) { Expand-Archive -Path "$WORK\source.zip" -DestinationPath $WORK -Force } # ---------- Step 2: OBS source ---------- Write-Host "[2/5] OBS Studio source" -ForegroundColor Cyan Get-IfMissing "https://github.com/obsproject/obs-studio/archive/refs/tags/$OBS_VERSION.zip" "$WORK\obs.zip" "OBS $OBS_VERSION" -if (-not (Test-Path "$WORK\obs-studio")) { +if (-not (Test-Path "$WORK\obs-studio\CMakeLists.txt")) { Expand-Archive -Path "$WORK\obs.zip" -DestinationPath $WORK -Force - Rename-Item "$WORK\obs-studio-$OBS_VERSION" "$WORK\obs-studio" + if (Test-Path "$WORK\obs-studio-$OBS_VERSION") { + Rename-Item "$WORK\obs-studio-$OBS_VERSION" "$WORK\obs-studio" + } } # ---------- Step 3: Dependencies ---------- -Write-Host "[3/5] OBS pre-built dependencies" -ForegroundColor Cyan +Write-Host "[3/5] OBS dependencies" -ForegroundColor Cyan New-Item -ItemType Directory -Path "$WORK\deps" -Force | Out-Null -Get-IfMissing "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-$DEPS_DATE-x64.zip" "$WORK\deps\deps.zip" "Dependencies (~60MB)" -if (-not (Test-Path "$WORK\deps\include")) { +Get-IfMissing "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-$DEPS_DATE-x64.zip" "$WORK\deps\deps.zip" "Deps (~60MB)" +if (-not (Test-Path "$WORK\deps\include\obs")) { Expand-Archive -Path "$WORK\deps\deps.zip" -DestinationPath "$WORK\deps" -Force } Get-IfMissing "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-qt6-$DEPS_DATE-x64-RelWithDebInfo.zip" "$WORK\deps\qt6.zip" "Qt6 (~200MB)" -if (-not (Test-Path "$WORK\deps\bin\Qt6Core.dll")) { +if (-not (Test-Path "$WORK\deps\lib\cmake\Qt6")) { Expand-Archive -Path "$WORK\deps\qt6.zip" -DestinationPath "$WORK\deps" -Force } -# ---------- Step 4: Build OBS libraries ---------- -Write-Host "[4/5] Building OBS libraries" -ForegroundColor Cyan +# ---------- Step 4: Build OBS ---------- +Write-Host "[4/5] OBS libraries" -ForegroundColor Cyan $obsBuild = "$WORK\obs-studio\build_x64" if (-not (Test-Path "$obsBuild\libobs\Release\obs.lib")) { Push-Location "$WORK\obs-studio" cmake -S . -B build_x64 ` -G "Visual Studio 17 2022" -A x64 ` - -DENABLE_PLUGINS=OFF ` - -DENABLE_UI=OFF ` - -DENABLE_SCRIPTING=OFF ` - -DCMAKE_BUILD_TYPE=Release ` - -DQT_VERSION=6 ` + -DENABLE_PLUGINS=OFF -DENABLE_UI=OFF -DENABLE_SCRIPTING=OFF ` + -DCMAKE_BUILD_TYPE=Release -DQT_VERSION=6 ` -DCMAKE_PREFIX_PATH="$WORK\deps" 2>&1 | Out-Null - cmake --build build_x64 --config Release --target libobs -- /m /noLogo 2>&1 | Write-Host cmake --build build_x64 --config Release --target obs-frontend-api -- /m /noLogo 2>&1 | Write-Host Pop-Location } else { - Write-Host " OBS libraries (cached)" -ForegroundColor DarkGray + Write-Host " OBS libs (cached)" -ForegroundColor DarkGray } # ---------- Step 5: Build plugin ---------- -Write-Host "[5/5] Building Vulcast Vertical" -ForegroundColor Cyan +Write-Host "[5/5] Vulcast Vertical plugin" -ForegroundColor Cyan Push-Location $SRC if (-not (Test-Path "build\CMakeCache.txt")) { cmake -S . -B build ` @@ -154,8 +141,7 @@ if (-not (Test-Path "build\CMakeCache.txt")) { -Dlibobs_DIR="$obsBuild\libobs" ` -Dobs-frontend-api_DIR="$obsBuild\UI\obs-frontend-api" ` -DCMAKE_PREFIX_PATH="$WORK\deps" ` - -DQT_VERSION=6 ` - -DCMAKE_BUILD_TYPE=Release 2>&1 | Write-Host + -DQT_VERSION=6 -DCMAKE_BUILD_TYPE=Release 2>&1 | Write-Host } cmake --build build --config Release -- /m /noLogo 2>&1 | Write-Host Pop-Location @@ -169,5 +155,5 @@ if ($dll) { 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 for build errors." + Write-Error "DLL not found. Check output above." }