upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDanila Kupreenko <71517730+5headsmartbtw@users.noreply.github.com>2026-11-23 18:55:44 +0300
committerGitHub <noreply@github.com>2026-11-23 09:55:44 -0600
commitac700c42b169fea79f9ffa1afdde13541b48a04f (patch)
treefaa8ebb1b7850a19f1f58ba43cffffb1f2e28ca1 /scripts
parent3e25531253dda3c0394a03dad93cd76ff8a1ab6e (diff)
Fix CMake batch invocation for caret paths (BUILD-2278) (#6787)
Squash-merged after diff review of PR #6787 - Fix CMake invocation in caret checkout paths (BUILD-2278)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build_runtime.ps116
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/build_runtime.ps1 b/scripts/build_runtime.ps1
index 831d05174..2fd5120cc 100644
--- a/scripts/build_runtime.ps1
+++ b/scripts/build_runtime.ps1
@@ -61,9 +61,19 @@ $sdl = if ($FetchSdl3) { "-DLEONIDA_SDL3_FETCH=ON" } else { "" }
61$vk = if ($env:VULKAN_SDK) { "-DLEONIDA_REQUIRE_VULKAN=ON" } else { "" } 61$vk = if ($env:VULKAN_SDK) { "-DLEONIDA_REQUIRE_VULKAN=ON" } else { "" }
62 62
63if ($cmake -and $ninja) { 63if ($cmake -and $ninja) {
64 $configure = "`"$cmake`" -S `"$src`" -B `"$out`" -G Ninja `"-DCMAKE_MAKE_PROGRAM=$ninja`" -DCMAKE_BUILD_TYPE=$cfg $sdl $vk"
65 $build = "`"$cmake`" --build `"$out`" -j $jobs"
66 # CALL reparses even quoted arguments and doubles a ^ in a checkout path.
67 # A native executable returns directly; a PATH .cmd/.bat wrapper needs its own
68 # cmd.exe so it returns here too, without CALL's second expansion.
69 if ([System.IO.Path]::GetExtension($cmake) -in @(".cmd", ".bat")) {
70 # Escape the outer quotes for the parent batch parser, keeping paths quoted there too.
71 $configure = 'cmd.exe /d /s /c ^"' + $configure + '^"'
72 $build = 'cmd.exe /d /s /c ^"' + $build + '^"'
73 }
64 $body = @" 74 $body = @"
65call "$cmake" -S "$src" -B "$out" -G Ninja "-DCMAKE_MAKE_PROGRAM=$ninja" -DCMAKE_BUILD_TYPE=$cfg $sdl $vk || exit /b 1 75$configure || exit /b 1
66call "$cmake" --build "$out" -j $jobs || exit /b 1 76$build || exit /b 1
67"@ 77"@
68} else { 78} else {
69 # Keep this list in step with runtime\CMakeLists.txt. Optional parts that need a dependency are left out here: 79 # Keep this list in step with runtime\CMakeLists.txt. Optional parts that need a dependency are left out here:
@@ -103,6 +113,8 @@ if defined VULKAN_SDK cl /nologo /std:c++20 /EHsc /O2 /DWIN32_LEAN_AND_MEAN /DNO
103# (e.g. Spanish "Nota: inclusión del archivo:") match Ninja's msvc_deps_prefix instead of being mojibaked in OEM CP. 113# (e.g. Spanish "Nota: inclusión del archivo:") match Ninja's msvc_deps_prefix instead of being mojibaked in OEM CP.
104$bat = Join-Path $out "_build.cmd" 114$bat = Join-Path $out "_build.cmd"
105# Keep the paths encoded for CP 65001 and start with an ASCII command that cmd.exe can read before switching. 115# Keep the paths encoded for CP 65001 and start with an ASCII command that cmd.exe can read before switching.
116# Here-strings follow the script's checkout line endings; cmd.exe needs CRLF in the generated UTF-8 batch.
117$body = $body -replace "`r?`n", "`r`n"
106$batchText = "@echo off`r`nchcp 65001 >nul`r`nset `"PATH=$installer;%PATH%`"`r`ncall `"$vcvars`" >nul || exit /b 1`r`n$body`r`n" 118$batchText = "@echo off`r`nchcp 65001 >nul`r`nset `"PATH=$installer;%PATH%`"`r`ncall `"$vcvars`" >nul || exit /b 1`r`n$body`r`n"
107[System.IO.File]::WriteAllText($bat, $batchText, [System.Text.UTF8Encoding]::new($false)) 119[System.IO.File]::WriteAllText($bat, $batchText, [System.Text.UTF8Encoding]::new($false))
108 120