-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy_build_assets.ps1
More file actions
50 lines (46 loc) · 1.92 KB
/
Copy pathcopy_build_assets.ps1
File metadata and controls
50 lines (46 loc) · 1.92 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
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025-2026 the psp-recomp authors
#requires -Version 7.6
#
# copy_build_assets.ps1 — post-link asset copy for the `compile` Makefile target.
#
# Pulled out of the Makefile's inline PowerShell one-liner because nested
# quoting inside that string broke whenever `make` was invoked from a non-cmd.exe shell (Git
# Bash / MSYS2 sh) — the shell's own quote-stripping mangled the embedded PowerShell before
# the PowerShell host ever saw it, producing "Missing condition in if statement after 'if ('".
# Invoked via `-File` instead of `-Command` so argument passing is plain argv, not a
# string embedded inside another shell's command line — no nested-quoting surface at all.
#
# Copies SDL3.dll and font/ into the build output directory, checking both the current
# directory and its parent (Makefile is normally invoked from the repo root, but this
# supports being run one level down too, matching the original one-liner's behavior).
param(
[Parameter(Mandatory = $true)]
[string]$BuildDir,
[switch]$ExcludeOptionalFonts
)
New-Item -ItemType Directory -Path $BuildDir -Force | Out-Null
if (Test-Path 'SDL3.dll') {
Copy-Item 'SDL3.dll' $BuildDir -Force
} elseif (Test-Path '../SDL3.dll') {
Copy-Item '../SDL3.dll' $BuildDir -Force
} else {
$gccCmd = Get-Command gcc -ErrorAction SilentlyContinue
if ($gccCmd) {
$binDir = Split-Path $gccCmd.Source
$toolchainSdl = Join-Path $binDir 'SDL3.dll'
if (Test-Path $toolchainSdl) {
Copy-Item $toolchainSdl $BuildDir -Force
}
}
}
if (-not $ExcludeOptionalFonts) {
$fontSrc = if (Test-Path 'font') { 'font' } elseif (Test-Path '../font') { '../font' } else { '' }
if ($fontSrc) {
$fontDst = Join-Path $BuildDir 'font'
if (Test-Path $fontDst) {
Remove-Item $fontDst -Recurse -Force
}
Copy-Item $fontSrc $fontDst -Recurse -Force
}
}