fix: write CMakeUserPresets.json to avoid cmd 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
d6d5bad9eb
commit
77234228a2
1 changed files with 34 additions and 9 deletions
|
|
@ -1,14 +1,15 @@
|
||||||
#Requires -Version 5.1
|
#Requires -Version 5.1
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Build Vulcast Vertical OBS plugin - v5 (uses cmake presets)
|
Build Vulcast Vertical OBS plugin - v6 (writes cmake cache directly)
|
||||||
#>
|
#>
|
||||||
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"
|
||||||
|
$buildDir = Join-Path $PluginDir "build_x64"
|
||||||
|
|
||||||
Write-Host "=== Vulcast Vertical Build v5 ===" -ForegroundColor Cyan
|
Write-Host "=== Vulcast Vertical Build v6 ===" -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"
|
||||||
|
|
@ -19,20 +20,44 @@ $vcvarsall = Join-Path $installPath "VC\Auxiliary\Build\vcvarsall.bat"
|
||||||
|
|
||||||
# 2. Clone or update plugin source
|
# 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/4] Cloning source..." -ForegroundColor Cyan
|
||||||
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/4] Pulling updates..." -ForegroundColor Cyan
|
||||||
git -C $PluginDir pull
|
git -C $PluginDir pull
|
||||||
}
|
}
|
||||||
|
|
||||||
# 3. Build using cmake preset (handles deps automatically)
|
# 3. Write CMakeUserPresets.json to avoid long command lines
|
||||||
Write-Host "[2/3] Configuring cmake..." -ForegroundColor Cyan
|
Write-Host "[2/4] Writing cmake presets..." -ForegroundColor Cyan
|
||||||
cmd /c "call `"$vcvarsall`" x64 && cmake --preset windows-x64 -S `"$PluginDir`""
|
$preset = @{
|
||||||
|
version = 6
|
||||||
|
configurePresets = @(
|
||||||
|
@{
|
||||||
|
name = "vulcast-local"
|
||||||
|
displayName = "Vulcast Local Build"
|
||||||
|
generator = "Visual Studio 17 2022"
|
||||||
|
architecture = "x64"
|
||||||
|
binaryDir = "${sourceDir}/build_x64"
|
||||||
|
cacheVariables = @{
|
||||||
|
CMAKE_BUILD_TYPE = "Release"
|
||||||
|
CMAKE_SYSTEM_VERSION = "10.0.18363.657"
|
||||||
|
QT_VERSION = "6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} | ConvertTo-Json -Depth 10
|
||||||
|
|
||||||
|
$presetPath = Join-Path $PluginDir "CMakeUserPresets.json"
|
||||||
|
Set-Content -Path $presetPath -Value $preset -Encoding UTF8
|
||||||
|
|
||||||
|
# 4. Configure cmake
|
||||||
|
Write-Host "[3/4] Configuring cmake..." -ForegroundColor Cyan
|
||||||
|
New-Item -ItemType Directory -Path $buildDir -Force | Out-Null
|
||||||
|
cmd /c "call `"$vcvarsall`" x64 && cmake --preset vulcast-local -S `"$PluginDir`""
|
||||||
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }
|
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }
|
||||||
|
|
||||||
Write-Host "[3/3] Building DLL..." -ForegroundColor Cyan
|
# 5. Build
|
||||||
$buildDir = Join-Path $PluginDir "build_x64"
|
Write-Host "[4/4] Building DLL..." -ForegroundColor Cyan
|
||||||
cmd /c "call `"$vcvarsall`" x64 && cmake --build `"$buildDir`" --config Release"
|
cmd /c "call `"$vcvarsall`" x64 && cmake --build `"$buildDir`" --config Release"
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Build failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Build failed" }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue