fix: use cmake presets to avoid cmd.exe line length limit
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run
This commit is contained in:
parent
a9d0ebe0d3
commit
d6d5bad9eb
1 changed files with 15 additions and 15 deletions
|
|
@ -1,45 +1,45 @@
|
||||||
#Requires -Version 5.1
|
#Requires -Version 5.1
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Build Vulcast Vertical OBS plugin - v5 (uses cmake presets)
|
||||||
|
#>
|
||||||
param()
|
param()
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$CacheDir = Join-Path $env:LOCALAPPDATA "vulcast-build"
|
$CacheDir = Join-Path $env:LOCALAPPDATA "vulcast-build"
|
||||||
$PluginDir = Join-Path $CacheDir "vulcast-vertical"
|
$PluginDir = Join-Path $CacheDir "vulcast-vertical"
|
||||||
$PluginBuild = Join-Path $PluginDir "build"
|
|
||||||
|
|
||||||
Write-Host "=== Vulcast Vertical Build ===" -ForegroundColor Cyan
|
Write-Host "=== Vulcast Vertical Build v5 ===" -ForegroundColor Cyan
|
||||||
|
|
||||||
# 1. Find VS Build Tools
|
# 1. Find VS Build Tools
|
||||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||||
if (!(Test-Path $vswhere)) { throw "VS Build Tools not found. Install from https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022" }
|
if (!(Test-Path $vswhere)) { throw "VS Build Tools not found" }
|
||||||
$installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath 2>$null
|
$installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath 2>$null
|
||||||
if (!$installPath) { throw "VS Build Tools not found" }
|
if (!$installPath) { throw "VS Build Tools not found" }
|
||||||
$vcvarsall = Join-Path $installPath "VC\Auxiliary\Build\vcvarsall.bat"
|
$vcvarsall = Join-Path $installPath "VC\Auxiliary\Build\vcvarsall.bat"
|
||||||
if (!(Test-Path $vcvarsall)) { throw "vcvarsall.bat not found" }
|
|
||||||
|
|
||||||
# 2. Clone or update plugin source (deps live in .deps/ inside source - persists)
|
# 2. Clone or update plugin source
|
||||||
if (!(Test-Path (Join-Path $PluginDir ".git"))) {
|
if (!(Test-Path (Join-Path $PluginDir ".git"))) {
|
||||||
Write-Host "[1/3] Cloning source..." -ForegroundColor Cyan
|
Write-Host "[1/3] Cloning source..." -ForegroundColor Cyan
|
||||||
if (Test-Path $PluginDir) { Remove-Item $PluginDir -Recurse -Force }
|
|
||||||
git clone --depth 1 "ssh://git@git.216-75-142-55.sslip.io:2222/wawadmin/vulcast-vertical.git" $PluginDir
|
git clone --depth 1 "ssh://git@git.216-75-142-55.sslip.io:2222/wawadmin/vulcast-vertical.git" $PluginDir
|
||||||
} else {
|
} else {
|
||||||
Write-Host "[1/3] Pulling updates..." -ForegroundColor Cyan
|
Write-Host "[1/3] Pulling updates..." -ForegroundColor Cyan
|
||||||
git -C $PluginDir pull
|
git -C $PluginDir pull
|
||||||
}
|
}
|
||||||
|
|
||||||
# 3. Build plugin (incremental - cmake caches deps in .deps/)
|
# 3. Build using cmake preset (handles deps automatically)
|
||||||
Write-Host "[2/3] Configuring cmake..." -ForegroundColor Cyan
|
Write-Host "[2/3] Configuring cmake..." -ForegroundColor Cyan
|
||||||
New-Item -ItemType Directory -Path $PluginBuild -Force | Out-Null
|
cmd /c "call `"$vcvarsall`" x64 && cmake --preset windows-x64 -S `"$PluginDir`""
|
||||||
|
|
||||||
cmd /c "call `"$vcvarsall`" x64 && cmake -S `"$PluginDir`" -B `"$PluginBuild`" -G `"Visual Studio 17 2022`" -A x64 -DCMAKE_BUILD_TYPE=Release"
|
|
||||||
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }
|
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }
|
||||||
|
|
||||||
Write-Host "[3/3] Building DLL..." -ForegroundColor Cyan
|
Write-Host "[3/3] Building DLL..." -ForegroundColor Cyan
|
||||||
cmd /c "call `"$vcvarsall`" x64 && cmake --build `"$PluginBuild`" --config Release -- /p:BuildInParallel=true"
|
$buildDir = Join-Path $PluginDir "build_x64"
|
||||||
|
cmd /c "call `"$vcvarsall`" x64 && cmake --build `"$buildDir`" --config Release"
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Build failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Build failed" }
|
||||||
|
|
||||||
# Find and install DLL
|
# Find and install DLL
|
||||||
$dll = Get-ChildItem -Path $PluginBuild -Recurse -Filter "vulcast-vertical.dll" -ErrorAction SilentlyContinue | Select-Object -First 1
|
$dll = Get-ChildItem -Path $buildDir -Recurse -Filter "vulcast-vertical.dll" -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||||
if (!$dll) { $dll = Get-ChildItem -Path $PluginBuild -Recurse -Filter "vertical-canvas.dll" -ErrorAction SilentlyContinue | Select-Object -First 1 }
|
if (!$dll) { $dll = Get-ChildItem -Path $buildDir -Recurse -Filter "vertical-canvas.dll" -ErrorAction SilentlyContinue | Select-Object -First 1 }
|
||||||
if (!$dll) { $dll = Get-ChildItem -Path $PluginBuild -Recurse -Filter "*.dll" -ErrorAction SilentlyContinue | Where-Object { $_.FullName -notmatch "Qt6|obs" } | Select-Object -First 1 }
|
if (!$dll) { $dll = Get-ChildItem -Path $buildDir -Recurse -Filter "*.dll" -ErrorAction SilentlyContinue | Where-Object { $_.FullName -notmatch "Qt6|obs" } | Select-Object -First 1 }
|
||||||
|
|
||||||
if ($dll) {
|
if ($dll) {
|
||||||
$pluginsDir = Join-Path $env:ProgramFiles "obs-studio\obs-plugins\64bit"
|
$pluginsDir = Join-Path $env:ProgramFiles "obs-studio\obs-plugins\64bit"
|
||||||
|
|
@ -47,5 +47,5 @@ if ($dll) {
|
||||||
Copy-Item $dll.FullName $pluginsDir -Force
|
Copy-Item $dll.FullName $pluginsDir -Force
|
||||||
Write-Host "`nDone! DLL: $pluginsDir\$($dll.Name)" -ForegroundColor Green
|
Write-Host "`nDone! DLL: $pluginsDir\$($dll.Name)" -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
throw "DLL not found"
|
throw "DLL not found in build output"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue