Build OBS manually, pass pre-built libs to plugin cmake, skip auto-deps
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run

This commit is contained in:
Vulcast 2026-06-30 18:18:14 +01:00
parent 1bda03c974
commit 63b49749c9

View file

@ -2,12 +2,13 @@
<#
.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).
Builds OBS manually, then the plugin links against it.
#>
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$OBS_VERSION = '31.1.1'
$DEPS_DATE = '2025-07-11'
$WORK = "$env:TEMP\vulcast-build"
$SRC = "$WORK\vulcast-vertical"
@ -51,10 +52,7 @@ if (-not $vsPath) {
exit 1
}
$vsPath = Find-MSVC
if (-not $vsPath) {
Write-Error "Installed but not found. Restart terminal and run again."
exit 1
}
if (-not $vsPath) { Write-Error "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
@ -62,8 +60,6 @@ if (-not $vsPath) {
$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 '^([^=]+)=(.*)$') {
@ -72,25 +68,77 @@ cmd /c "`"$vcvars`" x64 >nul 2>&1 && set" | ForEach-Object {
}
if (Get-Command cl.exe -ErrorAction SilentlyContinue) { Write-Host "[OK] cl.exe ready`n" -ForegroundColor Green }
# ---------- Download source (skip if exists) ----------
# ---------- Directories ----------
New-Item -ItemType Directory -Path $WORK -Force | Out-Null
$DEPS = "$WORK\deps"
$OBS = "$WORK\obs-studio"
# ---------- Step 1: Source ----------
Write-Host "[1/5] Source code" -ForegroundColor Cyan
if (-not (Test-Path "$SRC\CMakeLists.txt")) {
Write-Host "Downloading source..." -ForegroundColor Yellow
Write-Host " Downloading..." -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
# ---------- Step 2: OBS source ----------
Write-Host "[2/5] OBS Studio source" -ForegroundColor Cyan
if (-not (Test-Path "$OBS\CMakeLists.txt")) {
Write-Host " Downloading..." -ForegroundColor Yellow
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-studio/archive/refs/tags/$OBS_VERSION.zip" -OutFile "$WORK\obs.zip"
Expand-Archive -Path "$WORK\obs.zip" -DestinationPath $WORK -Force
if (Test-Path "$WORK\obs-studio-$OBS_VERSION") { Rename-Item "$WORK\obs-studio-$OBS_VERSION" $OBS }
}
# ---------- Step 3: Dependencies ----------
Write-Host "[3/5] OBS pre-built dependencies" -ForegroundColor Cyan
New-Item -ItemType Directory -Path $DEPS -Force | Out-Null
if (-not (Test-Path "$DEPS\include\obs")) {
$depsUrl = "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-$DEPS_DATE-x64.zip"
Write-Host " Downloading deps (~60MB)..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $depsUrl -OutFile "$DEPS\deps.zip"
Expand-Archive -Path "$DEPS\deps.zip" -DestinationPath $DEPS -Force
}
if (-not (Test-Path "$DEPS\lib\cmake\Qt6")) {
$qt6Url = "https://github.com/obsproject/obs-deps/releases/download/$DEPS_DATE/windows-deps-qt6-$DEPS_DATE-x64.zip"
Write-Host " Downloading Qt6 (~250MB)..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $qt6Url -OutFile "$DEPS\qt6.zip"
Expand-Archive -Path "$DEPS\qt6.zip" -DestinationPath $DEPS -Force
}
# ---------- Step 4: Build OBS ----------
Write-Host "[4/5] Building OBS libraries" -ForegroundColor Cyan
$obsBuild = "$OBS\build_x64"
if (-not (Test-Path "$obsBuild\libobs\Release\obs.lib")) {
cmake -S $OBS -B $obsBuild `
-G "Visual Studio 17 2022" -A x64 `
-DENABLE_PLUGINS=OFF `
-DENABLE_UI=OFF `
-DENABLE_SCRIPTING=OFF `
-DCMAKE_PREFIX_PATH="$DEPS" 2>&1 | Write-Host
cmake --build $obsBuild --config Debug --target obs-frontend-api -- /m /noLogo 2>&1 | Write-Host
cmake --build $obsBuild --config Release --target obs-frontend-api -- /m /noLogo 2>&1 | Write-Host
# Install to deps dir so plugin can find it
cmake --install $obsBuild --component Development --config Debug --prefix "$DEPS" 2>&1 | Write-Host
cmake --install $obsBuild --component Development --config Release --prefix "$DEPS" 2>&1 | Write-Host
} else {
Write-Host " OBS libs (cached)" -ForegroundColor DarkGray
}
# ---------- Step 5: Build plugin ----------
Write-Host "[5/5] Building Vulcast Vertical" -ForegroundColor Cyan
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
-DCMAKE_PREFIX_PATH="$DEPS" `
-DQT_VERSION=6 `
-DCMAKE_BUILD_TYPE=Release `
-DFETCHCONTENT_FULLY_DISCONNECTED=ON 2>&1 | Write-Host
Write-Host "`nBuilding..." -ForegroundColor Yellow
cmake --build build --config Release -- /m /noLogo 2>&1 | Write-Host
Pop-Location