Skip to content

Commit

Permalink
[godot] Add mono flag to 4.x build.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Jul 19, 2023
1 parent 8d04c7a commit bdb9e13
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 13 deletions.
43 changes: 35 additions & 8 deletions spine-godot/build/build-v4.sh
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
31 changes: 26 additions & 5 deletions spine-godot/build/setup.sh
Expand Up @@ -4,25 +4,46 @@ 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
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
Expand Down

0 comments on commit bdb9e13

Please sign in to comment.