#!/usr/bin/env bash # Build the Windows (Desktop) target: native GDExtension + managed C# DLLs. # Run from the repo root. set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO_ROOT" # Pull submodules if missing. if [ ! -f "thirdparty/leanclr/CMakeLists.txt" ]; then git submodule update --init --recursive fi # Re-apply the LeanCLR NotImplemented patch if a fresh submodule overwrote it. if grep -q "LEANCLR_FATAL_ON_RAISE_NOT_IMPLEMENTED_ERROR 1" \ thirdparty/leanclr/src/runtime/build_config.h 2>/dev/null; then echo "[build-windows] Re-applying leanclr NotImplemented patch..." sed -i 's/LEANCLR_FATAL_ON_RAISE_NOT_IMPLEMENTED_ERROR 1/LEANCLR_FATAL_ON_RAISE_NOT_IMPLEMENTED_ERROR 0/' \ thirdparty/leanclr/src/runtime/build_config.h fi # Generate bindings (needs the just-fetched extension_api.json). python3 tools/binding_generator/generate_bindings.py \ --api build-master/_deps/godot-cpp-src/gdextension/extension_api.json # Configure CMake (first pass — fetches godot-cpp via FetchContent). cmake -S . -B build-master -DCMAKE_BUILD_TYPE=Debug # Re-configure so add_library sees the generated cpp, then build. cmake -S . -B build-master -DCMAKE_BUILD_TYPE=Debug cmake --build build-master --config Debug --target leanclr_godot # Managed C#. dotnet msbuild managed/GodotSharpCompat/GodotSharpCompat.csproj -p:Configuration=Debug dotnet msbuild project/Game.csproj -p:Configuration=Debug echo "[build-windows] Done. Run with: \"/path/to/Godot\" --path project"