Files
leanCLR_gdext/scripts/build-web.bat
T

42 lines
1.8 KiB
Batchfile
Raw Normal View History

2026-06-07 22:55:56 +08:00
@echo off
REM Build the Web (WASM) target. Requires Emscripten 3.1+ and Ninja on PATH.
setlocal
if not exist thirdparty\leanclr\CMakeLists.txt (
2026-06-07 23:55:51 +08:00
git submodule update --init --recursive
2026-06-07 22:55:56 +08:00
)
findstr /C:"LEANCLR_FATAL_ON_RAISE_NOT_IMPLEMENTED_ERROR 1" thirdparty\leanclr\src\runtime\build_config.h >nul 2>&1
if %errorlevel% == 0 (
2026-06-07 23:55:51 +08:00
echo [build-web] Re-applying leanclr NotImplemented patch...
powershell -Command "(Get-Content thirdparty/leanclr/src/runtime/build_config.h) -replace 'LEANCLR_FATAL_ON_RAISE_NOT_IMPLEMENTED_ERROR 1', 'LEANCLR_FATAL_ON_RAISE_NOT_IMPLEMENTED_ERROR 0' | Set-Content thirdparty/leanclr/src/runtime/build_config.h"
2026-06-07 22:55:56 +08:00
)
2026-06-07 23:14:44 +08:00
REM Assume Emscripten is on PATH (emsdk_env.bat / emsdk activated).
where emcc >nul 2>&1
if errorlevel 1 (
2026-06-07 23:55:51 +08:00
echo [build-web] emcc not found on PATH. Activate Emscripten via emsdk_env.bat first. 1>&2
exit /b 1
2026-06-07 22:55:56 +08:00
)
2026-06-07 23:14:44 +08:00
echo [build-web] Using emcc from PATH.
2026-06-07 22:55:56 +08:00
2026-06-08 00:11:49 +08:00
cmake -S . -B build-web -G Ninja -DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE="%EMSDK%\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake" ^
-DEMSCRIPTEN=1
2026-06-07 22:55:56 +08:00
if errorlevel 1 (
2026-06-07 23:55:51 +08:00
echo [build-web] Initial cmake configure failed, running binding generator and retrying...
python3 tools\binding_generator\generate_bindings.py --api build-web\_deps\godot-cpp-src\gdextension\extension_api.json
if errorlevel 1 exit /b 1
2026-06-08 00:11:49 +08:00
cmake -S . -B build-web -G Ninja -DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE="%EMSDK%\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake" ^
-DEMSCRIPTEN=1
2026-06-07 22:55:56 +08:00
)
2026-06-07 23:55:51 +08:00
cmake --build build-web --config Release --target leanclr_godot
2026-06-07 22:55:56 +08:00
2026-06-07 23:55:51 +08:00
dotnet msbuild managed\GodotSharpCompat\GodotSharpCompat.csproj -p:Configuration=Debug
dotnet msbuild project\Game.csproj -p:Configuration=Debug
2026-06-07 22:55:56 +08:00
echo [build-web] Done. Output: project\bin\Release\libleanclr_godot.wasm
echo [build-web] Export the project for Web in the Godot editor to run.