comparison third_party/emsdk/emsdk.ps1 @ 179:8d17f6e6e290

[ThirdParty] Added emsdk bazel rules that can be supported by bazel 9.0.0
author MrJuneJune <me@mrjunejune.com>
date Thu, 22 Jan 2026 21:23:17 -0800
parents
children
comparison
equal deleted inserted replaced
178:94705b5986b3 179:8d17f6e6e290
1 $ScriptDirectory = Split-Path -parent $PSCommandPath
2
3 $PythonLocations = $(
4 "python\3.13.3_64bit\python.exe",
5 "python\3.9.2_64bit\python.exe",
6 "python\3.9.2-nuget_64bit\python.exe"
7 )
8
9 # Find python from an explicit location relative to the Emscripten SDK.
10 foreach ($Location in $PythonLocations) {
11 $FullLocation = Join-Path $ScriptDirectory $Location
12 if (Test-Path $FullLocation) {
13 $EMSDK_PY = $FullLocation
14 break
15 }
16 }
17
18 # As a last resort, access from PATH.
19 if (-Not $EMSDK_PY) {
20 $EMSDK_PY = "python"
21 }
22
23 # Tell EMSDK to create environment variable setter as a .ps1 file
24 $env:EMSDK_POWERSHELL = 1
25
26 & $EMSDK_PY "$ScriptDirectory/emsdk.py" $args
27
28 $ExitCode = $LASTEXITCODE
29
30 # python is not able to set environment variables to the parent calling process, so
31 # therefore have it craft a .ps1 file, which we invoke after finishing python execution,
32 # to set up the environment variables
33 if ($ExitCode -eq 0 -and (Test-Path $ScriptDirectory/emsdk_set_env.ps1)) {
34 & $ScriptDirectory/emsdk_set_env.ps1
35 Remove-Item $ScriptDirectory/emsdk_set_env.ps1
36 }
37
38 Remove-Item Env:\EMSDK_POWERSHELL
39
40 exit $ExitCode