fix: use cmake -C cache file to avoid cmd line length limit
Some checks failed
Build Windows DLL / Build for Windows (push) Has been cancelled
Some checks failed
Build Windows DLL / Build for Windows (push) Has been cancelled
This commit is contained in:
parent
cd449bb46d
commit
59d81726eb
1 changed files with 21 additions and 34 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Build Vulcast Vertical OBS plugin - v7 (downloads zip, no git needed)
|
||||
Build Vulcast Vertical OBS plugin - v8 (uses cmake cache file)
|
||||
#>
|
||||
param()
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
|
@ -9,7 +9,7 @@ $CacheDir = Join-Path $env:LOCALAPPDATA "vulcast-build"
|
|||
$PluginDir = Join-Path $CacheDir "vulcast-vertical"
|
||||
$buildDir = Join-Path $PluginDir "build_x64"
|
||||
|
||||
Write-Host "=== Vulcast Vertical Build v7 ===" -ForegroundColor Cyan
|
||||
Write-Host "=== Vulcast Vertical Build v8 ===" -ForegroundColor Cyan
|
||||
|
||||
# 1. Find VS Build Tools
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
|
|
@ -18,52 +18,39 @@ $installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.C
|
|||
if (!$installPath) { throw "VS Build Tools not found" }
|
||||
$vcvarsall = Join-Path $installPath "VC\Auxiliary\Build\vcvarsall.bat"
|
||||
|
||||
# 2. Download and extract plugin source (no git needed)
|
||||
$zipPath = Join-Path $CacheDir "vulcast-vertical-latest.zip"
|
||||
# 2. Download and extract plugin source
|
||||
if (!(Test-Path (Join-Path $PluginDir "CMakeLists.txt"))) {
|
||||
Write-Host "[1/4] Downloading source..." -ForegroundColor Cyan
|
||||
if (Test-Path $PluginDir) { Remove-Item $PluginDir -Recurse -Force }
|
||||
New-Item -ItemType Directory -Path $CacheDir -Force | Out-Null
|
||||
$zipPath = Join-Path $CacheDir "vulcast-vertical-latest.zip"
|
||||
Invoke-WebRequest -Uri "https://vulcast.xyz/dl/vulcast-vertical-latest.zip" -OutFile $zipPath
|
||||
Expand-Archive -Path $zipPath -DestinationPath $PluginDir -Force
|
||||
# If zip has a root folder, flatten it
|
||||
$inner = Get-ChildItem -Path $PluginDir -Directory | Select-Object -First 1
|
||||
if ($inner -and (Test-Path (Join-Path $inner.FullName "CMakeLists.txt"))) {
|
||||
Get-ChildItem -Path $inner.FullName -Force | Move-Item -Destination $PluginDir -Force
|
||||
Remove-Item $inner.FullName -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
} else {
|
||||
Write-Host "[1/4] Source already cached." -ForegroundColor Green
|
||||
Write-Host "[1/4] Source cached." -ForegroundColor Green
|
||||
}
|
||||
|
||||
# 3. Write CMakeUserPresets.json
|
||||
Write-Host "[2/4] Writing cmake presets..." -ForegroundColor Cyan
|
||||
$presetJson = @'
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
'@
|
||||
$presetPath = Join-Path $PluginDir "CMakeUserPresets.json"
|
||||
Set-Content -Path $presetPath -Value $presetJson -Encoding UTF8
|
||||
|
||||
# 4. Configure cmake
|
||||
Write-Host "[3/4] Configuring cmake..." -ForegroundColor Cyan
|
||||
# 3. Write cmake initial cache file (avoids long command line)
|
||||
Write-Host "[2/4] Writing cmake cache..." -ForegroundColor Cyan
|
||||
$cacheFile = Join-Path $buildDir "vulcast-init.cmake"
|
||||
New-Item -ItemType Directory -Path $buildDir -Force | Out-Null
|
||||
cmd /c "call `"$vcvarsall`" x64 && cmake --preset vulcast-local -S `"$PluginDir`""
|
||||
|
||||
$cacheContent = @"
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
|
||||
set(CMAKE_SYSTEM_VERSION "10.0.18363.657" CACHE STRING "")
|
||||
set(QT_VERSION "6" CACHE STRING "")
|
||||
"@
|
||||
Set-Content -Path $cacheFile -Value $cacheContent -Encoding UTF8
|
||||
|
||||
# 4. Configure cmake using -C flag (short command line)
|
||||
Write-Host "[3/4] Configuring cmake..." -ForegroundColor Cyan
|
||||
$configureCmd = "cmake -S `"$PluginDir`" -B `"$buildDir`" -G `"Visual Studio 17 2022`" -A x64 -C `"$cacheFile`""
|
||||
cmd /c "call `"$vcvarsall`" x64 && $configureCmd"
|
||||
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }
|
||||
|
||||
# 5. Build
|
||||
|
|
@ -82,5 +69,5 @@ if ($dll) {
|
|||
Copy-Item $dll.FullName $pluginsDir -Force
|
||||
Write-Host "`nDone! DLL: $pluginsDir\$($dll.Name)" -ForegroundColor Green
|
||||
} else {
|
||||
throw "DLL not found in build output"
|
||||
throw "DLL not found"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue