Build script: use OBS 32.1.2, skip cached downloads
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run

This commit is contained in:
Vulcast 2026-06-29 23:44:10 +01:00
parent 22137002a0
commit a49cfaa441

View file

@ -2,17 +2,20 @@
<# <#
.SYNOPSIS .SYNOPSIS
Downloads and builds the Vulcast Vertical OBS plugin DLL. Downloads and builds the Vulcast Vertical OBS plugin DLL.
Auto-installs VS Build Tools if needed (~3GB download). Auto-installs VS Build Tools if needed. Skips downloads if already cached.
#> #>
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
$OBS_VERSION = '31.1.0' # Bump these when OBS updates
$OBS_VERSION = '32.1.2'
$DEPS_DATE = '2026-06-25' $DEPS_DATE = '2026-06-25'
$WORK = "$env:TEMP\vulcast-build" $WORK = "$env:TEMP\vulcast-build"
$SRC = "$WORK\vulcast-vertical" $SRC = "$WORK\vulcast-vertical"
Write-Host "=== Vulcast Vertical Build Script ===" -ForegroundColor Cyan Write-Host "=== Vulcast Vertical Build Script ===" -ForegroundColor Cyan
Write-Host "OBS $OBS_VERSION | Deps $DEPS_DATE"
Write-Host "" Write-Host ""
# ---------- Check / Install Build Tools ---------- # ---------- Check / Install Build Tools ----------
@ -22,12 +25,13 @@ function Find-MSVC {
$p = & $vsWhere -latest -property installationPath 2>$null $p = & $vsWhere -latest -property installationPath 2>$null
if ($p) { return $p } if ($p) { return $p }
} }
# Check for Build Tools in common locations
foreach ($v in '2022','2019') { foreach ($v in '2022','2019') {
$bt = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\$v\BuildTools" foreach ($ed in 'BuildTools','Community','Professional','Enterprise') {
if (Test-Path "$bt\VC\Auxiliary\Build\vcvarsall.bat") { return $bt } $p = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\$v\$ed"
$ent = "${env:ProgramFiles}\Microsoft Visual Studio\$v" if (Test-Path "$p\VC\Auxiliary\Build\vcvarsall.bat") { return $p }
if (Test-Path "$ent\VC\Auxiliary\Build\vcvarsall.bat") { return $ent } $p = "${env:ProgramFiles}\Microsoft Visual Studio\$v\$ed"
if (Test-Path "$p\VC\Auxiliary\Build\vcvarsall.bat") { return $p }
}
} }
return $null return $null
} }
@ -35,12 +39,13 @@ function Find-MSVC {
$vsPath = Find-MSVC $vsPath = Find-MSVC
if (-not $vsPath) { if (-not $vsPath) {
Write-Host "C++ Build Tools not found. Installing VS 2022 Build Tools..." -ForegroundColor Yellow Write-Host "C++ Build Tools not found. Installing VS 2022 Build Tools..." -ForegroundColor Yellow
Write-Host "(This downloads ~3GB and takes 5-15 minutes)" -ForegroundColor Yellow Write-Host "(Downloads ~3GB, takes 5-15 minutes)" -ForegroundColor Yellow
$installer = "$env:TEMP\vs_buildtools.exe" $installer = "$env:TEMP\vs_buildtools.exe"
Invoke-WebRequest -Uri 'https://aka.ms/vs/17/release/vs_BuildTools.exe' -OutFile $installer if (-not (Test-Path $installer)) {
Invoke-WebRequest -Uri 'https://aka.ms/vs/17/release/vs_BuildTools.exe' -OutFile $installer
}
# Install C++ workload silently
$proc = Start-Process -FilePath $installer -ArgumentList @( $proc = Start-Process -FilePath $installer -ArgumentList @(
'--quiet', '--wait', '--norestart', '--quiet', '--wait', '--norestart',
'--add', 'Microsoft.VisualStudio.Workload.VCTools', '--add', 'Microsoft.VisualStudio.Workload.VCTools',
@ -50,111 +55,119 @@ if (-not $vsPath) {
) -Wait -PassThru ) -Wait -PassThru
if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) { if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) {
Write-Error "Build Tools install failed (exit code $($proc.ExitCode)). Install manually from https://visualstudio.microsoft.com/downloads/" Write-Error "Build Tools install failed (exit $($proc.ExitCode)). Install manually: https://visualstudio.microsoft.com/downloads/"
exit 1 exit 1
} }
$vsPath = Find-MSVC $vsPath = Find-MSVC
if (-not $vsPath) { if (-not $vsPath) {
Write-Error "Build Tools installed but not detected. Try restarting your terminal and running this script again." Write-Error "Installed but not detected. Restart terminal and run again."
exit 1 exit 1
} }
Write-Host "[OK] Build Tools installed at: $vsPath" -ForegroundColor Green Write-Host "[OK] Build Tools installed: $vsPath" -ForegroundColor Green
} else { } else {
Write-Host "[OK] Build Tools found at: $vsPath" -ForegroundColor Green Write-Host "[OK] Build Tools: $vsPath" -ForegroundColor Green
} }
# Find vcvarsall.bat
$vcvars = Get-ChildItem -Path $vsPath -Recurse -Filter 'vcvarsall.bat' -ErrorAction SilentlyContinue | $vcvars = Get-ChildItem -Path $vsPath -Recurse -Filter 'vcvarsall.bat' -ErrorAction SilentlyContinue |
Select-Object -First 1 -ExpandProperty FullName Select-Object -First 1 -ExpandProperty FullName
if (-not $vcvars) { if (-not $vcvars) { Write-Error "vcvarsall.bat not found"; exit 1 }
Write-Error "vcvarsall.bat not found under $vsPath"
exit 1
}
# Set up MSVC environment Write-Host "Setting up MSVC x64..." -ForegroundColor Yellow
Write-Host "Setting up MSVC x64 environment..." -ForegroundColor Yellow
$envBackup = @{}
cmd /c "`"$vcvars`" x64 >nul 2>&1 && set" | ForEach-Object { cmd /c "`"$vcvars`" x64 >nul 2>&1 && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') { if ($_ -match '^([^=]+)=(.*)$') {
$envBackup[$Matches[1]] = [System.Environment]::GetEnvironmentVariable($Matches[1])
[System.Environment]::SetEnvironmentVariable($Matches[1], $Matches[2]) [System.Environment]::SetEnvironmentVariable($Matches[1], $Matches[2])
} }
} }
# Verify cl.exe is available
$cl = Get-Command cl.exe -ErrorAction SilentlyContinue $cl = Get-Command cl.exe -ErrorAction SilentlyContinue
if ($cl) { Write-Host "[OK] MSVC compiler: $($cl.Source)" -ForegroundColor Green } if ($cl) { Write-Host "[OK] Compiler: $($cl.Source)" -ForegroundColor Green }
else { Write-Warning "cl.exe not found in PATH — build may fail." }
# ---------- Clean previous build ---------- # ---------- Download helper (skip if cached) ----------
if (Test-Path $WORK) { Remove-Item $WORK -Recurse -Force } function Get-IfMissing {
New-Item -ItemType Directory -Path $WORK -Force | Out-Null param([string]$Url, [string]$Path, [string]$Label)
if (Test-Path $Path) {
# Step 1: Download source Write-Host " $Label (cached)" -ForegroundColor DarkGray
Write-Host "`n[1/5] Downloading source..." -ForegroundColor Yellow return
Invoke-WebRequest -Uri 'https://vulcast.xyz/dl/vulcast-vertical-source.zip' -OutFile "$WORK\source.zip" }
Expand-Archive -Path "$WORK\source.zip" -DestinationPath $WORK Write-Host " $Label..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $Url -OutFile $Path
# Step 2: Download OBS Studio source }
Write-Host "[2/5] Downloading OBS Studio $OBS_VERSION..." -ForegroundColor Yellow
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-studio/archive/refs/tags/$OBS_VERSION.zip" -OutFile "$WORK\obs.zip" # ---------- Step 1: Source ----------
Expand-Archive -Path "$WORK\obs.zip" -DestinationPath $WORK Write-Host "`n[1/5] Source code" -ForegroundColor Cyan
Rename-Item "$WORK\obs-studio-$OBS_VERSION" "$WORK\obs-studio" New-Item -ItemType Directory -Path $WORK -Force | Out-Null
Get-IfMissing 'https://vulcast.xyz/dl/vulcast-vertical-source.zip' "$WORK\source.zip" "vulcast-vertical"
# Step 3: Download OBS pre-built dependencies if (-not (Test-Path $SRC)) {
Write-Host "[3/5] Downloading OBS dependencies (~60MB)..." -ForegroundColor Yellow Expand-Archive -Path "$WORK\source.zip" -DestinationPath $WORK -Force
New-Item -ItemType Directory -Path "$WORK\deps" -Force | Out-Null }
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-$DEPS_DATE-x64.zip" -OutFile "$WORK\deps\deps.zip"
Expand-Archive -Path "$WORK\deps\deps.zip" -DestinationPath "$WORK\deps" # ---------- Step 2: OBS source ----------
Write-Host "[2/5] OBS Studio source" -ForegroundColor Cyan
Write-Host " Downloading Qt6 (~250MB)..." -ForegroundColor Yellow Get-IfMissing "https://github.com/obsproject/obs-studio/archive/refs/tags/$OBS_VERSION.zip" "$WORK\obs.zip" "OBS $OBS_VERSION"
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-qt6-$DEPS_DATE-x64.zip" -OutFile "$WORK\deps\qt6.zip" if (-not (Test-Path "$WORK\obs-studio")) {
Expand-Archive -Path "$WORK\deps\qt6.zip" -DestinationPath "$WORK\deps" Expand-Archive -Path "$WORK\obs.zip" -DestinationPath $WORK -Force
Rename-Item "$WORK\obs-studio-$OBS_VERSION" "$WORK\obs-studio"
# Step 4: Build OBS libraries }
Write-Host "[4/5] Building OBS libraries..." -ForegroundColor Yellow
Push-Location "$WORK\obs-studio" # ---------- Step 3: Dependencies ----------
cmake -S . -B build_x64 ` Write-Host "[3/5] OBS pre-built dependencies" -ForegroundColor Cyan
-G "Visual Studio 17 2022" -A x64 ` New-Item -ItemType Directory -Path "$WORK\deps" -Force | Out-Null
-DENABLE_PLUGINS=OFF ` Get-IfMissing "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-$DEPS_DATE-x64.zip" "$WORK\deps\deps.zip" "Dependencies (~60MB)"
-DENABLE_UI=OFF ` if (-not (Test-Path "$WORK\deps\include")) {
-DENABLE_SCRIPTING=OFF ` Expand-Archive -Path "$WORK\deps\deps.zip" -DestinationPath "$WORK\deps" -Force
-DCMAKE_BUILD_TYPE=Release ` }
-DQT_VERSION=6 `
-DCMAKE_PREFIX_PATH="$WORK\deps" 2>&1 | Out-Null 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")) {
cmake --build build_x64 --config Release --target libobs -- /m /consoleLoggerParameters:Summary /noLogo 2>&1 | Write-Host Expand-Archive -Path "$WORK\deps\qt6.zip" -DestinationPath "$WORK\deps" -Force
cmake --build build_x64 --config Release --target obs-frontend-api -- /m /consoleLoggerParameters:Summary /noLogo 2>&1 | Write-Host }
Pop-Location
# ---------- Step 4: Build OBS libraries ----------
# Step 5: Build the plugin Write-Host "[4/5] Building OBS libraries" -ForegroundColor Cyan
Write-Host "[5/5] Building Vulcast Vertical plugin..." -ForegroundColor Yellow $obsBuild = "$WORK\obs-studio\build_x64"
Push-Location $SRC if (-not (Test-Path "$obsBuild\libobs\Release\obs.lib")) {
cmake -S . -B build ` Push-Location "$WORK\obs-studio"
-G "Visual Studio 17 2022" -A x64 ` cmake -S . -B build_x64 `
-DBUILD_OUT_OF_TREE=On ` -G "Visual Studio 17 2022" -A x64 `
-Dlibobs_DIR="$WORK\obs-studio\build_x64\libobs" ` -DENABLE_PLUGINS=OFF `
-Dobs-frontend-api_DIR="$WORK\obs-studio\build_x64\UI\obs-frontend-api" ` -DENABLE_UI=OFF `
-DCMAKE_PREFIX_PATH="$WORK\deps" ` -DENABLE_SCRIPTING=OFF `
-DQT_VERSION=6 ` -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_BUILD_TYPE=Release 2>&1 | Write-Host -DQT_VERSION=6 `
-DCMAKE_PREFIX_PATH="$WORK\deps" 2>&1 | Out-Null
cmake --build build --config Release -- /m /consoleLoggerParameters:Summary /noLogo 2>&1 | Write-Host
Pop-Location 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
# Copy DLL to desktop Pop-Location
$dllPath = Get-ChildItem -Path "$SRC\build" -Recurse -Filter "vulcast-vertical.dll" -ErrorAction SilentlyContinue | Select-Object -First 1 } else {
if ($dllPath) { Write-Host " OBS libraries (cached)" -ForegroundColor DarkGray
$dest = "$env:USERPROFILE\Desktop\vulcast-vertical.dll" }
Copy-Item $dllPath.FullName $dest -Force
Write-Host "`n=== BUILD SUCCESSFUL ===" -ForegroundColor Green # ---------- Step 5: Build plugin ----------
Write-Host "DLL saved to: $dest" -ForegroundColor Green Write-Host "[5/5] Building Vulcast Vertical" -ForegroundColor Cyan
Write-Host "" Push-Location $SRC
Write-Host "To install:" -ForegroundColor Cyan if (-not (Test-Path "build\CMakeCache.txt")) {
Write-Host ' Copy "' -NoNewline; Write-Host $dest -ForegroundColor Yellow -NoNewline; Write-Host '" to' cmake -S . -B build `
Write-Host ' "C:\Program Files\obs-studio\obs-plugins\64bit\"' -G "Visual Studio 17 2022" -A x64 `
Write-Host " Then restart OBS Studio." -DBUILD_OUT_OF_TREE=On `
} else { -Dlibobs_DIR="$obsBuild\libobs" `
Write-Error "Build succeeded but DLL not found. Check build output above for errors." -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
}
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 for build errors."
} }