[godot] Add mono flag to 4.x build.

This commit is contained in:
Mario Zechner 2023-07-19 11:56:34 +02:00
parent 8d04c7a75b
commit bdb9e130bc
2 changed files with 61 additions and 13 deletions

View File

@ -11,6 +11,26 @@ fi
target=""
dev="false"
mono="false"
if [ $# -gt 0 ]; then
if [ $# -gt 1 ]; then
echo "Usage: $0 [mono:true|false]"
exit 1
else
if [ "$1" == "true" ] || [ "$1" == "false" ]; then
mono="$1"
else
echo "Invalid value for the 'mono' argument. It should be either 'true' or 'false'."
exit 1
fi
fi
fi
if [ -f "../godot/custom.py" ]; then
dev="true"
fi
if [ -f "../godot/custom.py" ]; then
dev="true"
fi
@ -26,16 +46,23 @@ fi
echo "CPUS: $cpus"
mono_module=""
mono_extension=""
if [ $mono = "true" ]; then
mono_module="module_mono_enabled=yes"
mono_extension=".mono"
fi
pushd ../godot
if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then
scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then
scons $target $mono_module arch=x86_64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
scons $target $mono_module arch=arm64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
pushd bin
cp -r ../misc/dist/macos_tools.app .
mv macos_tools.app Godot.app
mkdir -p Godot.app/Contents/MacOS
lipo -create godot.macos.editor.arm64 godot.macos.editor.x86_64 -output Godot
lipo -create godot.macos.editor.arm64$mono_extension godot.macos.editor.x86_64$mono_extension -output Godot
strip -S -x Godot
cp Godot Godot.app/Contents/MacOS/Godot
chmod +x Godot.app/Contents/MacOS/Godot
@ -47,11 +74,11 @@ else
if [ "$dev" = "true" ]; then
target="$target dev_build=true"
fi
scons $target compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
scons $target $mono_module compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
cp compile_commands.json ../build
if [ -f "bin/godot.linuxbsd.editor.x86_64" ]; then
strip bin/godot.linuxbsd.editor.x86_64
chmod a+x bin/godot.linuxbsd.editor.x86_64
if [ -f "bin/godot.linuxbsd.editor.x86_64$mono_extension" ]; then
strip bin/godot.linuxbsd.editor.x86_64$mono_extension
chmod a+x bin/godot.linuxbsd.editor.x86_64$mono_extension
fi
fi
popd

View File

@ -4,18 +4,36 @@ set -e
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
pushd "$dir" > /dev/null
if [ ! "$#" -eq 2 ]; then
echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false>"
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false> [mono:true|false]?"
echo
echo "e.g.:"
echo " ./setup.sh 3.4.4-stable true"
echo " ./setup.sh master false"
echo
echo " ./setup.sh 3.5.2-stable true"
echo " ./setup.sh master false true"
echo
echo "Note: the 'mono' parameter only works for Godot 4.x+!"
exit 1
fi
branch=${1%/}
dev=${2%/}
mono=false
if [[ $# -eq 3 && "$branch" != 3* ]]; then
mono=${3%/}
fi
if [ "$dev" != "true" ] && [ "$dev" != "false" ]; then
echo "Invalid value for the 'dev' argument. It should be either 'true' or 'false'."
exit 1
fi
if [ "$mono" != "true" ] && [ "$mono" != "false" ]; then
echo "Invalid value for the 'mono' argument. It should be either 'true' or 'false'."
exit 1
fi
pushd ..
rm -rf godot
@ -23,6 +41,9 @@ git clone --depth 1 https://github.com/godotengine/godot.git -b $branch
if [ $dev = "true" ]; then
cp -r .idea godot
cp build/custom.py godot
if [ "$mono" = "true" ]; then
echo "module_mono_enabled=\"yes\"" >> godot/custom.py
fi
cp ../formatters/.clang-format .
rm -rf example/.import
rm -rf example/.godot