@@ -250,7 +250,7 @@ if ($LASTEXITCODE -ne 0) {
250250Write-OK " Built in $buildSecs seconds"
251251
252252# =============================================================================
253- # Copy Third-Party DLLs (Irrlicht - not handled by Chrono's DLL copy command)
253+ # Copy Third-Party DLLs (not handled by Chrono's DLL copy command)
254254# =============================================================================
255255
256256$binPath = " .\build\bin\$BuildType "
@@ -270,28 +270,39 @@ if ($useIrrlicht) {
270270}
271271
272272if ($useVSG ) {
273- # Get VSG DLLs from vsgFramework bin directory
274- # First try to find vsg_DIR from chrono config
275- if ($chronoContent -match ' vsg_DIR\s+"([^"]+)"' ) {
276- $vsgDir = $Matches [1 ]
277- # vsg_DIR typically points to lib/cmake/vsg, so go up to find bin
278- $vsgRoot = Split-Path (Split-Path (Split-Path $vsgDir ))
279- $vsgBinDir = Join-Path $vsgRoot " bin"
280-
281- if (Test-Path $vsgBinDir ) {
282- $vsgDlls = Get-ChildItem - Path $vsgBinDir - Filter " *.dll" - ErrorAction SilentlyContinue
283- $copiedCount = 0
284- foreach ($dll in $vsgDlls ) {
285- $destDll = Join-Path $binPath $dll.Name
286- if (-not (Test-Path $destDll )) {
287- Copy-Item $dll.FullName $destDll - Force
288- $copiedCount ++
289- }
290- }
291- if ($copiedCount -gt 0 ) {
292- Write-OK " Copied $copiedCount VSG DLLs"
273+ # Get VSG DLL directory from Chrono config (set by find_package(vsg))
274+ # VSG_DLL_DIR is set by Chrono when it finds VSG
275+ $vsgDllDir = $null
276+
277+ if ($chronoContent -match ' VSG_DLL_DIR\s+([^\s\)]+)' ) {
278+ $vsgDllDir = $Matches [1 ].Trim(' "' )
279+ }
280+
281+ # Fallback: derive from vsg_DIR (lib/cmake/vsg -> bin)
282+ if (-not $vsgDllDir -or -not (Test-Path $vsgDllDir )) {
283+ if ($chronoContent -match ' vsg_DIR\s+"([^"]+)"' ) {
284+ $vsgCmakeDir = $Matches [1 ]
285+ # Go up from lib/cmake/vsg to root, then into bin
286+ $vsgRoot = Split-Path (Split-Path (Split-Path $vsgCmakeDir ))
287+ $vsgDllDir = Join-Path $vsgRoot " bin"
288+ }
289+ }
290+
291+ if ($vsgDllDir -and (Test-Path $vsgDllDir )) {
292+ $vsgDlls = Get-ChildItem - Path $vsgDllDir - Filter " *.dll" - ErrorAction SilentlyContinue
293+ $copiedCount = 0
294+ foreach ($dll in $vsgDlls ) {
295+ $destDll = Join-Path $binPath $dll.Name
296+ if (-not (Test-Path $destDll )) {
297+ Copy-Item $dll.FullName $destDll - Force
298+ $copiedCount ++
293299 }
294300 }
301+ if ($copiedCount -gt 0 ) {
302+ Write-OK " Copied $copiedCount VSG DLLs from $vsgDllDir "
303+ }
304+ } else {
305+ Write-Warn " VSG enabled but could not find VSG DLL directory"
295306 }
296307}
297308
0 commit comments