Skip to content

Commit 071c703

Browse files
committed
measure-693 round 5b: where rc.exe and windres look for a file a resource statement names
1 parent 648d23d commit 071c703

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/measure-693/rsp.ps1‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,26 @@ foreach ($k in $Dirs.Keys) {
145145
Reading "R1n.$k.$bom" "exit=$($r.code) output=$(Test-Path -LiteralPath (Join-Path $b 't.obj'))$note"
146146
}
147147
}
148+
149+
# ---------------------------------------------------------------------------
150+
# R2: where rc.exe and windres look for a file named by a resource statement.
151+
# The script sits in res/, the file beside it, and the tool runs from another
152+
# directory with /I (or -I) naming the project root, as mcpp runs it.
153+
154+
$P = Join-Path $Root 'rcproj'
155+
New-Item -ItemType Directory -Force -Path (Join-Path $P 'res'), (Join-Path $P 'out') | Out-Null
156+
[System.IO.File]::WriteAllText((Join-Path $P 'res\m.manifest'), "<?xml version=`"1.0`"?><assembly xmlns=`"urn:schemas-microsoft-com:asm.v1`" manifestVersion=`"1.0`"/>`n")
157+
[System.IO.File]::WriteAllText((Join-Path $P 'res\beside.rc'), "1 24 `"m.manifest`"`n")
158+
[System.IO.File]::WriteAllText((Join-Path $P 'res\rooted.rc'), "1 24 `"res/m.manifest`"`n")
159+
$O = Join-Path $P 'out'
160+
foreach ($f in @('beside', 'rooted')) {
161+
$r = Run 'rc.exe' @('/nologo', '/C', '65001', "/I$P", '/fo', "$O\$f.res", "$P\res\$f.rc") $O
162+
Reading "R2.rc.$f" "exit=$($r.code)$(if ($r.code -ne 0) { ' | ' + (FirstLine $r.out) })"
163+
}
164+
$windres = Get-Command windres.exe -ErrorAction SilentlyContinue
165+
if ($windres) {
166+
foreach ($f in @('beside', 'rooted')) {
167+
$r = Run $windres.Source @('-O', 'coff', '--codepage=65001', "-I$P", '-o', "$O\$f.o", "$P\res\$f.rc") $O
168+
Reading "R2.windres.$f" "exit=$($r.code)$(if ($r.code -ne 0) { ' | ' + (FirstLine $r.out) })"
169+
}
170+
} else { Reading 'R2.windres' 'absent' }

0 commit comments

Comments
 (0)