yuanshen/Yuanshen.Patch/build.ps1
wisedev 61cc2055cf First working version of the server
KCP gameserver with packet dispatch, scene streaming, combat, gacha and the
shop, plus a small HTTP server for the login flow and the wish history page.

Game data under assets is pulled out of the client instead of being typed by
hand. The excel tables come from the packed bin container and the spawn points
from the compiled scene scripts.
2026-09-04 02:06:53 +03:00

31 lines
1.3 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = $PSScriptRoot
$src = Join-Path $root 'src\dllmain.cpp'
$dist = Join-Path $root 'dist'
$output = Join-Path $dist 'version.dll'
$vcvars = @(
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat",
"C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat",
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
) | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $vcvars) { throw "vcvars64.bat not found - install the MSVC C++ toolset." }
New-Item -ItemType Directory -Force -Path $dist | Out-Null
Write-Host "Using $vcvars" -ForegroundColor Cyan
Write-Host "Compiling version.dll (x64)..." -ForegroundColor Cyan
$cl = "cl /nologo /std:c++17 /utf-8 /O2 /MT /EHsc /LD `"$src`" /Fe:`"$output`" /Fo:`"$dist\`" " +
"/link /DLL /MACHINE:X64"
& cmd /c "`"$vcvars`" >nul && $cl"
if ($LASTEXITCODE -ne 0) { throw "build failed ($LASTEXITCODE)" }
Remove-Item (Join-Path $dist '*.obj'), (Join-Path $dist 'version.exp'), (Join-Path $dist 'version.lib') -ErrorAction SilentlyContinue
Write-Host ""
Write-Host "Built $output" -ForegroundColor Green
Write-Host "Copy the dist folder contents (plus gadget.dll) into your game directory." -ForegroundColor Green