From 8a943c3f0045d00d48bb0d3565cc2cf168c96e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 2 Dec 2025 10:15:49 +0100 Subject: [PATCH] Add support for experimental .NET builds (GDExtension) (#136) This is eventually meant to be unified with the "classical" builds, but for the initial testing we start with a dedicated "dotnet" build. Co-authored-by: Raul Santos --- build-android/build.sh | 33 ++++++- build-dotnet/build.sh | 71 +++++++++++++++ build-ios/build.sh | 27 ++++++ build-linux/build.sh | 59 +++++++++++++ build-macos/build.sh | 26 ++++++ build-release.sh | 187 +++++++++++++++++++++++++++++++++++++--- build-visionos/build.sh | 19 ++++ build-web/build.sh | 23 +++++ build-windows/build.sh | 40 +++++++++ build.sh | 16 +++- 10 files changed, 486 insertions(+), 15 deletions(-) create mode 100755 build-dotnet/build.sh diff --git a/build-android/build.sh b/build-android/build.sh index 7abf261..9a5e530 100755 --- a/build-android/build.sh +++ b/build-android/build.sh @@ -4,11 +4,12 @@ set -e # Config -# Debug symbols are enabled for the Android builds so we can generate a separate debug symbols file. +# Debug symbols are enabled for the Android builds so we can generate a separate debug symbols file. # Gradle will strip them out of the final artifacts. export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no" export OPTIONS="production=yes debug_symbols=yes" export OPTIONS_MONO="module_mono_enabled=yes" +export OPTIONS_DOTNET="module_dotnet_enabled=yes" export TERM=xterm prepare_source() { @@ -143,4 +144,34 @@ if [ "${MONO}" == "1" ]; then cp bin/godot-lib.template_release.aar /root/out/templates-mono/ fi +# .NET + +if [ "${DOTNET}" == "1" ]; then + echo "Starting .NET build for Android..." + + prepare_source + + $SCONS platform=android arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=android arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_release + + $SCONS platform=android arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=android arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_release + + $SCONS platform=android arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=android arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_release + + $SCONS platform=android arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=android arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_release + + pushd platform/android/java + ./gradlew generateGodotMonoTemplates + popd + + mkdir -p /root/out/templates-dotnet + cp bin/android_source.zip /root/out/templates-dotnet/ + cp bin/android_monoDebug.apk /root/out/templates-dotnet/android_debug.apk + cp bin/android_monoRelease.apk /root/out/templates-dotnet/android_release.apk + cp bin/godot-lib.template_release.aar /root/out/templates-dotnet/ +fi + echo "Android build successful" diff --git a/build-dotnet/build.sh b/build-dotnet/build.sh new file mode 100755 index 0000000..3b9248d --- /dev/null +++ b/build-dotnet/build.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -e + +if [ "${DOTNET}" != "1" ]; then + exit 0 +fi + +dnf install -y clang python-unversioned-command + +git clone https://github.com/raulsntos/godot-dotnet +cd godot-dotnet +git checkout upgrade-assistant-plus-source-code-plugin-wip + +echo "Building and generating .NET extension..." + +# TODO: Get rid of this when we fix all these trimming warnings in godot-dotnet. +cat << EOF >> .editorconfig +# Disable trimming warnings because it spams the output too much. +dotnet_diagnostics.IL2111.severity = none +EOF + +prerelease_label="${GODOT_VERSION#*-}" +version_prefix="${GODOT_VERSION%-*}" + +if [[ "${prerelease_label}" == "${GODOT_VERSION}" ]]; then + prerelease_label="" +fi + +# TODO: Ensure we don't accidentally make stable releases. We can remove this when we're ready for a stable release. +if [[ -z "$prerelease_label" ]]; then + echo "YOU ARE NOT SUPPOSED TO MAKE A STABLE RELEASE WITH THIS" + exit -1 +fi + +version_component_count=$(grep -o "\." <<< "$version_prefix" | wc -l) + +if [ "$version_component_count" -eq 0 ]; then + version_prefix="${version_prefix}.0.0" +elif [ "$version_component_count" -eq 1 ]; then + version_prefix="${version_prefix}.0" +fi + +if [[ -n "$prerelease_label" ]]; then + if [[ "$prerelease_label" =~ ^dev ]]; then + prerelease_label="${prerelease_label/dev/alpha}" + fi + + prerelease_label=$(echo "$prerelease_label" | sed -E 's/([^0-9])([0-9])/\1.\2/g') +fi + +echo "Building Godot .NET version ${version_prefix} (prerelease: '${prerelease_label}')" + +dotnet --info + +build_id="$(date +%Y%m%d).1" +final_version_kind="release" +if [[ -n "$prerelease_label" ]]; then + final_version_kind="prerelease" +fi + +./build.sh --productBuild --ci --warnAsError false \ + /p:GenerateGodotBindings=true \ + /p:VersionPrefix=${version_prefix} \ + /p:OfficialBuildId=${build_id} \ + /p:FinalVersionKind=${final_version_kind} \ + /p:PreReleaseVersionLabel=${prerelease_label} + +cp -r artifacts/packages/Release/Shipping/* /root/out/ + +echo ".NET bindings generated successfully" diff --git a/build-ios/build.sh b/build-ios/build.sh index c3a8b77..1904423 100755 --- a/build-ios/build.sh +++ b/build-ios/build.sh @@ -9,6 +9,7 @@ export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_ # which is seen as a regression in the current workflow. export OPTIONS="production=yes use_lto=no SWIFT_FRONTEND=/root/.local/share/swiftly/toolchains/6.2.0/usr/bin/swift-frontend" export OPTIONS_MONO="module_mono_enabled=yes" +export OPTIONS_DOTNET="module_dotnet_enabled=yes" export TERM=xterm export IOS_SDK="26.0" @@ -76,4 +77,30 @@ if [ "${MONO}" == "1" ]; then cp bin/libgodot.ios.template_debug.x86_64.simulator.a /root/out/templates-mono/libgodot.ios.debug.simulator.a fi +# .NET + +if [ "${DOTNET}" == "1" ]; then + echo "Starting .NET build for iOS..." + + # arm64 device + $SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug $IOS_DEVICE $APPLE_TARGET_ARM64 + $SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release $IOS_DEVICE $APPLE_TARGET_ARM64 + + # arm64 simulator + # Disabled for now as it doesn't work with cctools-port and current LLVM. + # See https://github.com/godotengine/build-containers/pull/85. + #$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug $IOS_SIMULATOR $APPLE_TARGET_ARM64 + #$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release $IOS_SIMULATOR $APPLE_TARGET_ARM64 + + # x86_64 simulator + $SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_debug $IOS_SIMULATOR $APPLE_TARGET_X86_64 + $SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_release $IOS_SIMULATOR $APPLE_TARGET_X86_64 + + mkdir -p /root/out/templates-dotnet + cp bin/libgodot.ios.template_release.arm64.a /root/out/templates-dotnet/libgodot.ios.a + cp bin/libgodot.ios.template_debug.arm64.a /root/out/templates-dotnet/libgodot.ios.debug.a + cp bin/libgodot.ios.template_release.x86_64.simulator.a /root/out/templates-dotnet/libgodot.ios.simulator.a + cp bin/libgodot.ios.template_debug.x86_64.simulator.a /root/out/templates-dotnet/libgodot.ios.debug.simulator.a +fi + echo "iOS build successful" diff --git a/build-linux/build.sh b/build-linux/build.sh index bb6b352..fd63bb3 100755 --- a/build-linux/build.sh +++ b/build-linux/build.sh @@ -7,6 +7,7 @@ set -e export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no" export OPTIONS="production=yes accesskit_sdk_path=/root/accesskit/accesskit-c" export OPTIONS_MONO="module_mono_enabled=yes" +export OPTIONS_DOTNET="module_dotnet_enabled=yes" export TERM=xterm rm -rf godot @@ -137,4 +138,62 @@ if [ "${MONO}" == "1" ]; then rm -rf bin fi +# .NET + +if [ "${DOTNET}" == "1" ]; then + echo "Starting .NET build for Linux..." + + export PATH="${GODOT_SDK_LINUX_X86_64}/bin:${BASE_PATH}" + + $SCONS platform=linuxbsd arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=editor + mkdir -p /root/out/x86_64/tools-dotnet + cp -rvp bin/* /root/out/x86_64/tools-dotnet + rm -rf bin + + $SCONS platform=linuxbsd arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=linuxbsd arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_release + mkdir -p /root/out/x86_64/templates-dotnet + cp -rvp bin/* /root/out/x86_64/templates-dotnet + rm -rf bin + + export PATH="${GODOT_SDK_LINUX_X86_32}/bin:${BASE_PATH}" + + $SCONS platform=linuxbsd arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=editor + mkdir -p /root/out/x86_32/tools-dotnet + cp -rvp bin/* /root/out/x86_32/tools-dotnet + rm -rf bin + + $SCONS platform=linuxbsd arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=linuxbsd arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_release + mkdir -p /root/out/x86_32/templates-dotnet + cp -rvp bin/* /root/out/x86_32/templates-dotnet + rm -rf bin + + export PATH="${GODOT_SDK_LINUX_ARM64}/bin:${BASE_PATH}" + + $SCONS platform=linuxbsd arch=arm64 $OPTIONS $OPTIONS_DOTNET target=editor + mkdir -p /root/out/arm64/tools-dotnet + cp -rvp bin/* /root/out/arm64/tools-dotnet + rm -rf bin + + $SCONS platform=linuxbsd arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=linuxbsd arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_release + mkdir -p /root/out/arm64/templates-dotnet + cp -rvp bin/* /root/out/arm64/templates-dotnet + rm -rf bin + + export PATH="${GODOT_SDK_LINUX_ARM32}/bin:${BASE_PATH}" + + $SCONS platform=linuxbsd arch=arm32 $OPTIONS $OPTIONS_DOTNET target=editor + mkdir -p /root/out/arm32/tools-dotnet + cp -rvp bin/* /root/out/arm32/tools-dotnet + rm -rf bin + + $SCONS platform=linuxbsd arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=linuxbsd arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_release + mkdir -p /root/out/arm32/templates-dotnet + cp -rvp bin/* /root/out/arm32/templates-dotnet + rm -rf bin +fi + echo "Linux build successful" diff --git a/build-macos/build.sh b/build-macos/build.sh index aef12fb..f85b953 100755 --- a/build-macos/build.sh +++ b/build-macos/build.sh @@ -7,6 +7,7 @@ set -e export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no" export OPTIONS="osxcross_sdk=darwin25 production=yes use_volk=no vulkan_sdk_path=/root/moltenvk angle_libs=/root/angle accesskit_sdk_path=/root/accesskit/accesskit-c SWIFT_FRONTEND=/root/.local/share/swiftly/toolchains/6.2.0/usr/bin/swift-frontend" export OPTIONS_MONO="module_mono_enabled=yes" +export OPTIONS_DOTNET="module_dotnet_enabled=yes" export TERM=xterm rm -rf godot @@ -68,4 +69,29 @@ if [ "${MONO}" == "1" ]; then rm -rf bin fi +# .NET + +if [ "${DOTNET}" == "1" ]; then + echo "Starting .NET build for macOS..." + + $SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=editor + $SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=editor + lipo -create bin/godot.macos.editor.x86_64.dotnet bin/godot.macos.editor.arm64.dotnet -output bin/godot.macos.editor.universal.dotnet + + mkdir -p /root/out/tools-dotnet + cp -rvp bin/* /root/out/tools-dotnet + rm -rf bin + + $SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_debug + $SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug + lipo -create bin/godot.macos.template_debug.x86_64.dotnet bin/godot.macos.template_debug.arm64.dotnet -output bin/godot.macos.template_debug.universal.dotnet + $SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_release + $SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release + lipo -create bin/godot.macos.template_release.x86_64.dotnet bin/godot.macos.template_release.arm64.dotnet -output bin/godot.macos.template_release.universal.dotnet + + mkdir -p /root/out/templates-dotnet + cp -rvp bin/* /root/out/templates-dotnet + rm -rf bin +fi + echo "macOS build successful" diff --git a/build-release.sh b/build-release.sh index 5c7ae32..37f554a 100755 --- a/build-release.sh +++ b/build-release.sh @@ -33,13 +33,10 @@ sign_macos() { _macos_tmpdir=$(ssh "${OSX_HOST}" "mktemp -d") _reldir="$1" _binname="$2" - _is_mono="$3" + _appname="$3" - if [[ "${_is_mono}" == "1" ]]; then - _appname="Godot_mono.app" + if [[ "${_appname}" == "Godot_mono.app" ]]; then _sharpdir="${_appname}/Contents/Resources/GodotSharp" - else - _appname="Godot.app" fi scp "${_reldir}/${_binname}.zip" "${OSX_HOST}:${_macos_tmpdir}" @@ -76,7 +73,6 @@ sign_macos_template() { fi _macos_tmpdir=$(ssh "${OSX_HOST}" "mktemp -d") _reldir="$1" - _is_mono="$2" scp "${_reldir}/macos.zip" "${OSX_HOST}:${_macos_tmpdir}" ssh "${OSX_HOST}" " @@ -97,6 +93,7 @@ do_cleanup=1 make_tarball=1 build_classical=1 build_mono=1 +build_dotnet=0 while getopts "h?v:t:b:n-:" opt; do case "$opt" in @@ -105,7 +102,7 @@ while getopts "h?v:t:b:n-:" opt; do echo echo " -v godot version (e.g: 3.2-stable) [mandatory]" echo " -t templates version (e.g. 3.2.stable) [mandatory]" - echo " -b build target: all|classical|mono|none (default: all)" + echo " -b build target: all|classical|mono|dotnet|none (default: all)" echo " --no-cleanup disable deleting pre-existing output folders (default: false)" echo " --no-tarball disable generating source tarball (default: false)" echo @@ -119,12 +116,21 @@ while getopts "h?v:t:b:n-:" opt; do ;; b) if [ "$OPTARG" == "classical" ]; then + build_classical=1 build_mono=0 + build_dotnet=0 elif [ "$OPTARG" == "mono" ]; then build_classical=0 + build_mono=1 + build_dotnet=0 + elif [ "$OPTARG" == "dotnet" ]; then + build_classical=0 + build_mono=0 + build_dotnet=1 elif [ "$OPTARG" == "none" ]; then build_classical=0 build_mono=0 + build_dotnet=0 fi ;; -) @@ -156,9 +162,11 @@ fi export reldir="${basedir}/releases/${godot_version}" export reldir_mono="${reldir}/mono" +export reldir_dotnet="${reldir}/dotnet" export tmpdir="${basedir}/tmp" export templatesdir="${tmpdir}/templates" export templatesdir_mono="${tmpdir}/mono/templates" +export templatesdir_dotnet="${tmpdir}/dotnet/templates" export webdir="${basedir}/web/${templates_version}" export steamdir="${basedir}/steam" @@ -174,9 +182,15 @@ if [ "${do_cleanup}" == "1" ]; then rm -rf ${steamdir} mkdir -p ${reldir} - mkdir -p ${reldir_mono} + if [ "${build_mono}" ]; then + mkdir -p ${reldir_mono} + fi + if [ "${build_dotnet}" ]; then + mkdir -p ${reldir_dotnet} + fi mkdir -p ${templatesdir} mkdir -p ${templatesdir_mono} + mkdir -p ${templatesdir_dotnet} mkdir -p ${webdir} if [ -d out/windows/steam ]; then mkdir -p ${steamdir} @@ -294,7 +308,7 @@ if [ "${build_classical}" == "1" ]; then chmod +x Godot.app/Contents/MacOS/Godot zip -q -9 -r "${reldir}/${binname}.zip" Godot.app rm -rf Godot.app - sign_macos ${reldir} ${binname} 0 + sign_macos ${reldir} ${binname} Godot.app # Templates rm -rf macos_template.app @@ -306,7 +320,7 @@ if [ "${build_classical}" == "1" ]; then chmod +x macos_template.app/Contents/MacOS/godot_macos* zip -q -9 -r "${templatesdir}/macos.zip" macos_template.app rm -rf macos_template.app - sign_macos_template ${templatesdir} 0 + sign_macos_template ${templatesdir} ## Steam (Classical) ## @@ -523,7 +537,7 @@ if [ "${build_mono}" == "1" ]; then chmod +x Godot_mono.app/Contents/MacOS/Godot zip -q -9 -r "${reldir_mono}/${binname}.zip" Godot_mono.app rm -rf Godot_mono.app - sign_macos ${reldir_mono} ${binname} 1 + sign_macos ${reldir_mono} ${binname} Godot_mono.app # Templates rm -rf macos_template.app @@ -534,7 +548,7 @@ if [ "${build_mono}" == "1" ]; then chmod +x macos_template.app/Contents/MacOS/godot_macos* zip -q -9 -r "${templatesdir_mono}/macos.zip" macos_template.app rm -rf macos_template.app - sign_macos_template ${templatesdir_mono} 1 + sign_macos_template ${templatesdir_mono} ## Android (Mono) ## @@ -600,4 +614,153 @@ if [ "${build_mono}" == "1" ]; then fi +# .NET + +if [ "${build_dotnet}" == "1" ]; then + + ## Linux (.NET) ## + + for arch in x86_64 x86_32 arm64 arm32; do + # Editor + binname="${godot_basename}_dotnet_linux.${arch}" + cp out/linux/${arch}/tools-dotnet/godot.linuxbsd.editor.${arch}.dotnet ${binname} + zip -r -q -9 "${reldir_dotnet}/${binname}.zip" ${binname} + rm ${binname} + + # Templates + cp out/linux/${arch}/templates-dotnet/godot.linuxbsd.template_debug.${arch}.dotnet ${templatesdir_dotnet}/linux_debug.${arch} + cp out/linux/${arch}/templates-dotnet/godot.linuxbsd.template_release.${arch}.dotnet ${templatesdir_dotnet}/linux_release.${arch} + done + + # ICU data + if [ -f ${basedir}/git/thirdparty/icu4c/icudt_godot.dat ]; then + cp ${basedir}/git/thirdparty/icu4c/icudt_godot.dat ${templatesdir_dotnet}/icudt_godot.dat + else + echo "icudt_godot.dat" not found. + fi + + ## Windows (.NET) ## + + declare -A win_arch_map=( + ["x86_64"]="win64" + ["x86_32"]="win32" + ["arm64"]="arm64" + ) + + for arch in x86_64 x86_32 arm64; do + # Editor + winarch=${win_arch_map[${arch}]} + binname="${godot_basename}_dotnet_${winarch}.exe" + wrpname="${godot_basename}_dotnet_${winarch}_console.exe" + [[ "${arch}" == "arm64" ]] && is_llvm=".llvm" + cp out/windows/${arch}/tools-dotnet/godot.windows.editor.${arch}${is_llvm}.dotnet.exe ${binname} + sign_windows ${binname} + cp out/windows/${arch}/tools-dotnet/godot.windows.editor.${arch}${is_llvm}.dotnet.console.exe ${wrpname} + sign_windows ${wrpname} + zip -r -q -9 "${reldir_dotnet}/${binname}.zip" ${binname} ${wrpname} + rm ${binname} ${wrpname} + + # Templates + cp out/windows/${arch}/templates-dotnet/godot.windows.template_debug.${arch}${is_llvm}.dotnet.exe ${templatesdir_dotnet}/windows_debug_${arch}.exe + cp out/windows/${arch}/templates-dotnet/godot.windows.template_release.${arch}${is_llvm}.dotnet.exe ${templatesdir_dotnet}/windows_release_${arch}.exe + cp out/windows/${arch}/templates-dotnet/godot.windows.template_debug.${arch}${is_llvm}.dotnet.console.exe ${templatesdir_dotnet}/windows_debug_${arch}_console.exe + cp out/windows/${arch}/templates-dotnet/godot.windows.template_release.${arch}${is_llvm}.dotnet.console.exe ${templatesdir_dotnet}/windows_release_${arch}_console.exe + done + + ## macOS (.NET) ## + + # Editor + binname="${godot_basename}_dotnet_macos.universal" + rm -rf Godot_dotnet.app + cp -r git/misc/dist/macos_tools.app Godot_dotnet.app + mkdir -p Godot_dotnet.app/Contents/MacOS + cp out/macos/tools-dotnet/godot.macos.editor.universal.dotnet Godot_dotnet.app/Contents/MacOS/Godot + chmod +x Godot_dotnet.app/Contents/MacOS/Godot + zip -q -9 -r "${reldir_dotnet}/${binname}.zip" Godot_dotnet.app + rm -rf Godot_dotnet.app + sign_macos ${reldir_dotnet} ${binname} Godot_dotnet.app + + # Templates + rm -rf macos_template.app + cp -r git/misc/dist/macos_template.app . + mkdir -p macos_template.app/Contents/MacOS + cp out/macos/templates-dotnet/godot.macos.template_debug.universal.dotnet macos_template.app/Contents/MacOS/godot_macos_debug.universal + cp out/macos/templates-dotnet/godot.macos.template_release.universal.dotnet macos_template.app/Contents/MacOS/godot_macos_release.universal + chmod +x macos_template.app/Contents/MacOS/godot_macos* + zip -q -9 -r "${templatesdir_dotnet}/macos.zip" macos_template.app + rm -rf macos_template.app + sign_macos_template ${templatesdir_dotnet} + + ## Android (.NET) ## + + # Lib for direct download + cp out/android/templates-dotnet/godot-lib.template_release.aar ${reldir_dotnet}/godot-lib.${templates_version}.dotnet.template_release.aar + + # Templates + cp out/android/templates-dotnet/*.apk ${templatesdir_dotnet}/ + cp out/android/templates-dotnet/android_source.zip ${templatesdir_dotnet}/ + + ## iOS (.NET) ## + + rm -rf ios_xcode + cp -r git/misc/dist/apple_embedded_xcode ios_xcode + cp out/ios/templates-dotnet/libgodot.ios.simulator.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a + cp out/ios/templates-dotnet/libgodot.ios.debug.simulator.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a + cp out/ios/templates-dotnet/libgodot.ios.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a + cp out/ios/templates-dotnet/libgodot.ios.debug.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a + cp -r deps/moltenvk/MoltenVK/MoltenVK.xcframework ios_xcode/ + rm -rf ios_xcode/MoltenVK.xcframework/{macos,tvos}* + cd ios_xcode + zip -q -9 -r "${templatesdir_dotnet}/ios.zip" * + cd .. + rm -rf ios_xcode + + ## visionOS (.NET) ## + + #rm -rf visionos_xcode + #cp -r git/misc/dist/apple_embedded_xcode visionos_xcode + #cp out/visionos/templates-dotnet/libgodot.visionos.a visionos_xcode/libgodot.visionos.release.xcframework/xros-arm64/libgodot.a + #cp out/visionos/templates-dotnet/libgodot.visionos.debug.a visionos_xcode/libgodot.visionos.debug.xcframework/xros-arm64/libgodot.a + #cd visionos_xcode + #zip -q -9 -r "${templatesdir_dotnet}/visionos.zip" * + #cd .. + #rm -rf visionos_xcode + + # No .NET support for those platforms yet. + + if false; then + + ## Web (.NET) ## + + # Templates + cp out/web/templates-dotnet/godot.web.template_debug.wasm32.dotnet.zip ${templatesdir_dotnet}/web_debug.zip + cp out/web/templates-dotnet/godot.web.template_release.wasm32.dotnet.zip ${templatesdir_dotnet}/web_release.zip + + fi + + ## Templates TPZ (.NET) ## + + echo "${templates_version}.dotnet" > ${templatesdir_dotnet}/version.txt + pushd ${templatesdir_dotnet}/.. + zip -q -9 -r -D "${reldir_dotnet}/${godot_basename}_dotnet_export_templates.tpz" templates/* + popd + + ## .NET bindings ## + + dotnetname="godot-dotnet-${templates_version}" + mkdir ${dotnetname} + cp out/dotnet/* ${dotnetname}/ + zip -q -9 -r "${reldir_dotnet}/${dotnetname}.zip" ${dotnetname} + rm -rf ${dotnetname} + + ## SHA-512 sums (.NET) ## + + pushd ${reldir_dotnet} + sha512sum [Gg]* >> SHA512-SUMS.txt + mkdir -p ${basedir}/sha512sums/${godot_version}/dotnet + cp SHA512-SUMS.txt ${basedir}/sha512sums/${godot_version}/dotnet/ + popd + +fi + echo "All editor binaries and templates prepared successfully for release" diff --git a/build-visionos/build.sh b/build-visionos/build.sh index 725bb59..7a30fce 100755 --- a/build-visionos/build.sh +++ b/build-visionos/build.sh @@ -10,6 +10,7 @@ export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_ # Disable Vulkan and MoltenVK for visionOS - visionOS doesn't support MoltenVK. export OPTIONS="production=yes use_lto=no vulkan=no SWIFT_FRONTEND=/root/.local/share/swiftly/toolchains/6.2.0/usr/bin/swift-frontend" export OPTIONS_MONO="module_mono_enabled=yes" +export OPTIONS_DOTNET="module_dotnet_enabled=yes" export TERM=xterm export VISIONOS_SDK="26.0" @@ -60,4 +61,22 @@ if [ "${MONO}" == "1" ]; then cp bin/libgodot.visionos.template_debug.arm64.a /root/out/templates-mono/libgodot.visionos.debug.a fi +# .NET + +if [ "${DOTNET}" == "1" ]; then + echo "Starting .NET build for visionOS..." + + # arm64 device + $SCONS platform=visionos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug $VISIONOS_DEVICE $APPLE_TARGET_ARM64 + $SCONS platform=visionos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release $VISIONOS_DEVICE $APPLE_TARGET_ARM64 + + # arm64 simulator (disabled for now, see build-ios) + #$SCONS platform=visionos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug $VISIONOS_SIMULATOR $APPLE_TARGET_ARM64 + #$SCONS platform=visionos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release $VISIONOS_SIMULATOR $APPLE_TARGET_ARM64 + + mkdir -p /root/out/templates-dotnet + cp bin/libgodot.visionos.template_release.arm64.a /root/out/templates-dotnet/libgodot.visionos.a + cp bin/libgodot.visionos.template_debug.arm64.a /root/out/templates-dotnet/libgodot.visionos.debug.a +fi + echo "visionOS build successful" diff --git a/build-web/build.sh b/build-web/build.sh index 531fc7e..272e758 100755 --- a/build-web/build.sh +++ b/build-web/build.sh @@ -23,6 +23,7 @@ declare -a JOBS_NOTHREADS=( export SCONS="scons -j$(expr ${NUM_CORES} / ${NUM_JOBS}) verbose=yes warnings=no progress=no redirect_build_objects=no" export OPTIONS="production=yes" export OPTIONS_MONO="module_mono_enabled=yes -j${NUM_CORES}" +export OPTIONS_MONO="module_dotnet_enabled=yes -j${NUM_CORES}" export TERM=xterm source /root/emsdk/emsdk_env.sh @@ -94,4 +95,26 @@ if false; then rm -f bin/*.zip fi + + + +# .NET + + + + + +# No Web support with .NET yet. +#if [ "${DOTNET}" == "1" ]; then +if false; then + echo "Starting .NET build for Web..." + + $SCONS platform=web ${OPTIONS} ${OPTIONS_DOTNET} target=template_debug + $SCONS platform=web ${OPTIONS} ${OPTIONS_DOTNET} target=template_release + + mkdir -p /root/out/templates-dotnet + cp -rvp bin/*.zip /root/out/templates-dotnet + rm -f bin/*.zip +fi + echo "Web build successful" diff --git a/build-windows/build.sh b/build-windows/build.sh index c0ccaaa..5a4a847 100755 --- a/build-windows/build.sh +++ b/build-windows/build.sh @@ -7,6 +7,7 @@ set -e export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no" export OPTIONS="production=yes use_mingw=yes angle_libs=/root/angle mesa_libs=/root/mesa d3d12=yes accesskit_sdk_path=/root/accesskit/accesskit-c" export OPTIONS_MONO="module_mono_enabled=yes" +export OPTIONS_DOTNET="module_dotnet_enabled=yes" export OPTIONS_LLVM="use_llvm=yes mingw_prefix=/root/llvm-mingw" export TERM=xterm @@ -110,4 +111,43 @@ if [ "${MONO}" == "1" ]; then rm -rf bin fi +# .NET + +if [ "${DOTNET}" == "1" ]; then + echo "Starting .NET build for Windows..." + + $SCONS platform=windows arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=editor + mkdir -p /root/out/x86_64/tools-dotnet + cp -rvp bin/* /root/out/x86_64/tools-dotnet + rm -rf bin + + $SCONS platform=windows arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=windows arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_release + mkdir -p /root/out/x86_64/templates-dotnet + cp -rvp bin/* /root/out/x86_64/templates-dotnet + rm -rf bin + + $SCONS platform=windows arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=editor + mkdir -p /root/out/x86_32/tools-dotnet + cp -rvp bin/* /root/out/x86_32/tools-dotnet + rm -rf bin + + $SCONS platform=windows arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_debug + $SCONS platform=windows arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_release + mkdir -p /root/out/x86_32/templates-dotnet + cp -rvp bin/* /root/out/x86_32/templates-dotnet + rm -rf bin + + $SCONS platform=windows arch=arm64 $OPTIONS $OPTIONS_DOTNET $OPTIONS_LLVM target=editor + mkdir -p /root/out/arm64/tools-dotnet + cp -rvp bin/* /root/out/arm64/tools-dotnet + rm -rf bin + + $SCONS platform=windows arch=arm64 $OPTIONS $OPTIONS_DOTNET $OPTIONS_LLVM target=template_debug + $SCONS platform=windows arch=arm64 $OPTIONS $OPTIONS_DOTNET $OPTIONS_LLVM target=template_release + mkdir -p /root/out/arm64/templates-dotnet + cp -rvp bin/* /root/out/arm64/templates-dotnet + rm -rf bin +fi + echo "Windows build successful" diff --git a/build.sh b/build.sh index 4635f66..a22be5b 100755 --- a/build.sh +++ b/build.sh @@ -36,6 +36,7 @@ godot_version="" git_treeish="master" build_classical=1 build_mono=1 +build_dotnet=0 build_steam=0 force_download=0 skip_download=1 @@ -51,7 +52,7 @@ while getopts "h?r:u:p:v:g:b:fsc" opt; do echo " -p password" echo " -v godot version (e.g. 3.1-alpha5) [mandatory]" echo " -g git treeish (e.g. master)" - echo " -b all|classical|mono (default: all)" + echo " -b all|classical|mono|dotnet (default: all)" echo " -f force redownload of all images" echo " -s skip downloading" echo " -c skip checkout" @@ -75,9 +76,17 @@ while getopts "h?r:u:p:v:g:b:fsc" opt; do ;; b) if [ "$OPTARG" == "classical" ]; then + build_classical=1 build_mono=0 + build_dotnet=0 elif [ "$OPTARG" == "mono" ]; then build_classical=0 + build_mono=1 + build_dotnet=0 + elif [ "$OPTARG" == "dotnet" ]; then + build_classical=0 + build_mono=0 + build_dotnet=1 fi ;; f) @@ -247,12 +256,15 @@ EOF popd fi -export podman_run="${podman} run -it --rm --env BUILD_NAME=${BUILD_NAME} --env GODOT_VERSION_STATUS=${GODOT_VERSION_STATUS} --env NUM_CORES=${NUM_CORES} --env CLASSICAL=${build_classical} --env MONO=${build_mono} -v ${basedir}/godot-${godot_version}.tar.gz:/root/godot.tar.gz -v ${basedir}/mono-glue:/root/mono-glue -w /root/" +export podman_run="${podman} run -it --rm --env BUILD_NAME=${BUILD_NAME} --env GODOT_VERSION_STATUS=${GODOT_VERSION_STATUS} --env NUM_CORES=${NUM_CORES} --env CLASSICAL=${build_classical} --env MONO=${build_mono} --env DOTNET=${build_dotnet} -v ${basedir}/godot-${godot_version}.tar.gz:/root/godot.tar.gz -v ${basedir}/mono-glue:/root/mono-glue -w /root/" export img_version=$IMAGE_VERSION mkdir -p ${basedir}/mono-glue ${podman_run} -v ${basedir}/build-mono-glue:/root/build localhost/godot-linux:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/mono-glue +mkdir -p ${basedir}/out/dotnet +${podman_run} -v ${basedir}/build-dotnet:/root/build -v ${basedir}/out/dotnet:/root/out --env GODOT_VERSION=${godot_version} localhost/godot-linux:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/dotnet + mkdir -p ${basedir}/out/windows ${podman_run} -v ${basedir}/build-windows:/root/build -v ${basedir}/out/windows:/root/out -v ${basedir}/deps/angle:/root/angle -v ${basedir}/deps/mesa:/root/mesa -v ${basedir}/deps/accesskit:/root/accesskit --env STEAM=${build_steam} localhost/godot-windows:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/windows