Repository navigation
Expand file tree
/
Copy pathpackage.ps1
More file actions
66 lines (65 loc) · 4 KB
/
Copy pathpackage.ps1
File metadata and controls
66 lines (65 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
[CmdletBinding()]
param(
[string]$NativeBuild,
[string]$RuntimeAssets,
[string]$NextBoostEngine,
[string]$Destination
)
$ErrorActionPreference = 'Stop'
$project = (Resolve-Path $PSScriptRoot).Path
if (!$NativeBuild -or !$RuntimeAssets) {
throw 'Pass -NativeBuild (portal_media.dll and portal_media.lib) and -RuntimeAssets (media DLLs, shaders and models).'
}
if (!$Destination) { $Destination = Join-Path $project 'dist' }
$env:PORTAL_NATIVE_DIR = (Resolve-Path $NativeBuild).Path
cargo build --locked --manifest-path (Join-Path $project 'Cargo.toml')
if ($LASTEXITCODE) { throw 'Cargo build failed' }
$experimental = Join-Path $Destination 'runtime/experimental'
$licenses = Join-Path $Destination 'licenses'
New-Item -ItemType Directory -Force $experimental,$licenses,(Join-Path $Destination 'runtime_local') | Out-Null
Copy-Item -LiteralPath (Join-Path $project 'target/debug/psflow.exe'),(Join-Path $NativeBuild 'portal_media.dll') -Destination $Destination -Force
foreach ($name in 'avcodec-63.dll','avformat-63.dll','avutil-61.dll','avfilter-12.dll','swresample-7.dll','swscale-10.dll','dav1d.dll','opus.dll','libz.dll','libcrypto-3-x64.dll','libssl-3-x64.dll','D3Dcompiler_47.dll','dolby_vision.dll','dovi.dll','msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll') {
$file = Join-Path $RuntimeAssets $name
if (Test-Path -LiteralPath $file) { Copy-Item -LiteralPath $file -Destination $Destination -Force }
}
foreach ($name in 'shaders','runtime/models','runtime/config','runtime/experimental/nr-ampere','runtime/experimental/nr-original') {
$dir = Join-Path $Destination $name
New-Item -ItemType Directory -Path $dir -Force | Out-Null
Get-ChildItem -LiteralPath (Join-Path $RuntimeAssets $name) | Copy-Item -Destination $dir -Recurse -Force
}
foreach ($name in 'nvngx_vsr.dll','nvngx_dlss.dll','nvngx_truehdr.dll') {
Copy-Item -LiteralPath (Join-Path $RuntimeAssets "runtime/experimental/$name") -Destination $experimental -Force
}
Copy-Item -LiteralPath (Join-Path $RuntimeAssets 'LICENSE'),(Join-Path $RuntimeAssets 'THIRD_PARTY_NOTICES.md') -Destination $Destination -Force
Get-ChildItem -LiteralPath (Join-Path $RuntimeAssets 'licenses') | Copy-Item -Destination $licenses -Recurse -Force
foreach ($notice in 'OFL-BricolageGrotesque.txt','OFL-SourceSans3.txt','LICENSE-Lucide.txt') {
Copy-Item -LiteralPath (Join-Path $project "assets/$notice") -Destination $licenses -Force
}
# Keep each supplied frame-generation runtime in the directory its loader uses.
foreach ($name in 'runtime/nvidia-vfg','runtime/experimental/dlssg-kernels','runtime/experimental/dlssg-lite','runtime/experimental/fallback-dlssg-310.7','runtime_local/intel','runtime_local/amd') {
$source = Join-Path $RuntimeAssets $name
if (Test-Path -LiteralPath $source -PathType Container) {
$target = Join-Path $Destination $name
New-Item -ItemType Directory -Force $target | Out-Null
Get-ChildItem -LiteralPath $source | Copy-Item -Destination $target -Recurse -Force
}
}
# Stage the core and any installed generator packs from the supplied engine.
if ($NextBoostEngine) {
$source = (Resolve-Path -LiteralPath $NextBoostEngine).Path
$target = Join-Path $Destination 'framegen/engine'
New-Item -ItemType Directory -Force $target | Out-Null
Copy-Item -LiteralPath (Join-Path $source 'nvngx.dll') -Destination $target -Force
foreach ($name in 'nvngx_dlssg.dll','dlssg_compat','xess') {
$pack = Join-Path $source $name
if (Test-Path -LiteralPath $pack) { Copy-Item -LiteralPath $pack -Destination $target -Recurse -Force }
}
foreach ($pattern in 'msvcp*.dll','concrt*.dll','vcruntime*.dll') {
Get-ChildItem -LiteralPath $source -Filter $pattern -File | Copy-Item -Destination $target -Force
}
Copy-Item -LiteralPath (Join-Path $source 'ai') -Destination $target -Recurse -Force
}
$dlssg = Join-Path $RuntimeAssets 'runtime/experimental/nvngx_dlssg.dll'
if (Test-Path -LiteralPath $dlssg -PathType Leaf) {
Copy-Item -LiteralPath $dlssg -Destination $experimental -Force
}