standalone: VoxelForgeCore link-safe next to Unreal -- internals in vfcore::detail, symbol check

- The copied generator, mesher and Compat stand-ins compile inside vfcore::detail.
- CheckCoreSymbols.ps1 (run by Build.ps1) fails on any unqualified Unreal-style symbol in the
  library: 16,255 on 557f6aa, 0 now. A UE 5.7 CoreMinimal.h + VoxelForgeCore.h smoke compile passes.
- Output identical: 11 hash rows at W1/W8, routes 5642/5642, look/passage/far audits pass,
  bad-shell control fails, six captures byte-identical.
Cost, measured by me interleaved (8 workers, cold, 4 runs each, first run excluded): 0.963 s vs
0.937 s for 557f6aa, ~27 ms in shape compilation; same math, so codegen/inlining. To be found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-05 15:20:29 +02:00
1 parent 557f6aac30
commit aeeedaa73d
11 files changed
+461 -87

No files matched your search

+52 -5
View File
@@ -38,6 +38,32 @@ foreach ($Source in $CoreSources) {
if (-not (Test-Path -LiteralPath $Source -PathType Leaf)) { throw "Required core source is missing: $Source" }
}
# Keep the canonical source manifest shared with UBT, but compile every copied implementation
# source through a generated one-source shim that places its Unreal-shaped internals in a private
# namespace. The public API implementation owns its boundary and is compiled directly.
$WrapperDir = Join-Path $BuildDir 'wrappers'
[IO.Directory]::CreateDirectory($WrapperDir) | Out-Null
$CompileSources = [Collections.Generic.List[string]]::new()
foreach ($Index in 0..($CoreSources.Count-1)) {
$ManifestName = $CoreSourceNames[$Index].Replace('\','/')
if ($ManifestName -eq 'Core/src/VoxelForgeCore.cpp') {
$CompileSources.Add($CoreSources[$Index])
continue
}
$WrapperName = 'vfcore_' + ($ManifestName -replace '[^A-Za-z0-9]+','_')
$WrapperPath = Join-Path $WrapperDir ($WrapperName + '.cpp')
$SourceInclude = $CoreSources[$Index].Replace('\','/')
$WrapperText = @"
#include "CoreNamespacePreamble.h"
namespace vfcore::detail
{
#include "$SourceInclude"
}
"@
[IO.File]::WriteAllText($WrapperPath,$WrapperText,[Text.UTF8Encoding]::new($false))
$CompileSources.Add($WrapperPath)
}
$IncludeArgs = @(
('/I"{0}"' -f (Join-Path $Root 'Core\include')),
('/I"{0}"' -f (Join-Path $Root 'Core\src')),
@@ -48,16 +74,28 @@ $IncludeArgs = @(
)
$CommonFlags = @('/nologo','/std:c++20','/O2','/arch:AVX2','/fp:precise','/EHsc','/MP8','/D_CRT_SECURE_NO_WARNINGS') + $IncludeArgs
$CoreRsp = Join-Path $BuildDir 'core-compile.rsp'
$CoreRspLines = $CommonFlags + @('/c') + @($CoreSources | ForEach-Object { '"{0}"' -f $_ })
$CoreRspLines = $CommonFlags + @('/c') + @($CompileSources | ForEach-Object { '"{0}"' -f $_ })
[IO.File]::WriteAllLines($CoreRsp,$CoreRspLines,[Text.UTF8Encoding]::new($false))
$Objects = @($CoreSources | ForEach-Object { '"{0}.obj"' -f [IO.Path]::GetFileNameWithoutExtension($_) })
$Objects = @($CompileSources | ForEach-Object { '"{0}.obj"' -f [IO.Path]::GetFileNameWithoutExtension($_) })
$LibRsp = Join-Path $BuildDir 'core-library.rsp'
[IO.File]::WriteAllLines($LibRsp,@('/nologo',('/OUT:"{0}"' -f $CoreLibrary)) + $Objects,[Text.UTF8Encoding]::new($false))
$LegacySources = @()
$LegacyObjects = @()
$LegacyRsp = Join-Path $BuildDir 'viewer-reference-compile.rsp'
if ($Target -eq 'All') {
for ($Index=0; $Index -lt $CoreSources.Count; ++$Index) {
if ($CoreSourceNames[$Index].Replace('\','/') -eq 'Core/src/VoxelForgeCore.cpp') { continue }
$LegacySources += $CoreSources[$Index]
}
$LegacyObjects = @($LegacySources | ForEach-Object { '"{0}.obj"' -f [IO.Path]::GetFileNameWithoutExtension($_) })
$LegacyRspLines = $CommonFlags + @('/c') + @($LegacySources | ForEach-Object { '"{0}"' -f $_ })
[IO.File]::WriteAllLines($LegacyRsp,$LegacyRspLines,[Text.UTF8Encoding]::new($false))
}
$ViewerRsp = Join-Path $BuildDir 'viewer-link.rsp'
$ViewerRspLines = $CommonFlags + @(
('/Fe"{0}"' -f $OutputPath),
$ViewerRspLines = $CommonFlags + @('/Fe"{0}"' -f $OutputPath) + $LegacyObjects + @(
('"{0}"' -f (Join-Path $Root 'Source\StandaloneViewer.cpp')),
('"{0}"' -f $CoreLibrary),
'/link','d3d11.lib','dxgi.lib','d3dcompiler.lib','user32.lib','gdi32.lib'
@@ -69,11 +107,20 @@ try {
# One cl process with /MP8 bounds compiler work to eight processes; MSVC, lib.exe, and the
# viewer link inherit BelowNormal priority and the 0xFF00 process affinity from this host.
$CommandLine = 'call "{0}" >nul && cl.exe @"{1}" && lib.exe @"{2}"' -f $VcVars,$CoreRsp,$LibRsp
if ($Target -eq 'All') { $CommandLine += ' && cl.exe @"{0}"' -f $ViewerRsp }
& $env:ComSpec /d /s /c $CommandLine
if ($LASTEXITCODE -eq -1073741502) { throw 'A build process exited with 0xC0000142; stopping as required.' }
if ($LASTEXITCODE -ne 0) { throw "VoxelForgeCore build failed with exit code $LASTEXITCODE" }
if (-not (Test-Path -LiteralPath $CoreLibrary -PathType Leaf)) { throw "Core library was not produced: $CoreLibrary" }
$SymbolCheck = Join-Path $Root 'Core\CheckCoreSymbols.ps1'
& $SymbolCheck -LibraryPath $CoreLibrary
if ($Target -eq 'All') {
# The standalone viewer retains a global compatibility build only for legacy comparison
# and audits. Those objects are linked into the viewer executable, never into Core.lib.
$CommandLine = 'call "{0}" >nul && cl.exe @"{1}" && cl.exe @"{2}"' -f $VcVars,$LegacyRsp,$ViewerRsp
& $env:ComSpec /d /s /c $CommandLine
if ($LASTEXITCODE -eq -1073741502) { throw 'A build process exited with 0xC0000142; stopping as required.' }
if ($LASTEXITCODE -ne 0) { throw "Standalone viewer build failed with exit code $LASTEXITCODE" }
}
if ($Target -eq 'All' -and -not (Test-Path -LiteralPath $OutputPath -PathType Leaf)) { throw "Viewer was not produced: $OutputPath" }
} finally {
Pop-Location