From f2c7ab3683daeebea80c0bafd9bf040d48588391 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 27 Jun 2022 12:33:05 +0200 Subject: [PATCH] [godot] Rework build scripts for CI --- .gitignore | 1 + spine-godot/build.sh | 5 --- spine-godot/build/build-templates.sh | 19 +++++++++ spine-godot/{ => build}/build.bat | 0 spine-godot/build/build.sh | 56 +++++++++++++++++++++++++ spine-godot/{ => build}/custom.py | 0 spine-godot/{ => build}/livepp-v4.patch | 0 spine-godot/{ => build}/livepp.patch | 0 spine-godot/{ => build}/setup.bat | 0 spine-godot/setup.sh | 23 ---------- 10 files changed, 76 insertions(+), 28 deletions(-) delete mode 100755 spine-godot/build.sh create mode 100755 spine-godot/build/build-templates.sh rename spine-godot/{ => build}/build.bat (100%) create mode 100755 spine-godot/build/build.sh rename spine-godot/{ => build}/custom.py (100%) rename spine-godot/{ => build}/livepp-v4.patch (100%) rename spine-godot/{ => build}/livepp.patch (100%) rename spine-godot/{ => build}/setup.bat (100%) delete mode 100755 spine-godot/setup.sh diff --git a/.gitignore b/.gitignore index 77a57c84c..6506d9849 100644 --- a/.gitignore +++ b/.gitignore @@ -175,4 +175,5 @@ spine-godot/example/.godot spine-godot/example-v4/.godot spine-cocos2dx/example/build-macos spine-godot/logs +!spine-godot/build spine-ts/spine-ts.zip diff --git a/spine-godot/build.sh b/spine-godot/build.sh deleted file mode 100755 index 210da6841..000000000 --- a/spine-godot/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#/bin/sh -set -e -pushd godot -scons compiledb=yes custom_modules="../spine_godot" -j16 -popd \ No newline at end of file diff --git a/spine-godot/build/build-templates.sh b/spine-godot/build/build-templates.sh new file mode 100755 index 000000000..cf69150e1 --- /dev/null +++ b/spine-godot/build/build-templates.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +pushd $dir > /dev/null + +if [ "$#" -eq 0 ] && [ ! -d ../godot ]; then + echo "No Godot clone found. Run ./build.sh first." + exit 1 +fi + +pushd ../godot +if [ `uname` == "Darwin" ]; then + scons platform=osx tools=no target=release arch=x86_64 custom_modules="../spine_godot" --jobs=$(sysctl -n hw.logicalcpu) + scons platform=osx tools=no target=release_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$(sysctl -n hw.logicalcpu) + scons platform=osx tools=no target=release arch=arm64 custom_modules="../spine_godot" --jobs=$(sysctl -n hw.logicalcpu) + scons platform=osx tools=no target=release_debug arch=arm64 custom_modules="../spine_godot" --jobs=$(sysctl -n hw.logicalcpu) +fi +popd diff --git a/spine-godot/build.bat b/spine-godot/build/build.bat similarity index 100% rename from spine-godot/build.bat rename to spine-godot/build/build.bat diff --git a/spine-godot/build/build.sh b/spine-godot/build/build.sh new file mode 100755 index 000000000..9202e0b91 --- /dev/null +++ b/spine-godot/build/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -e + +dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +pushd $dir > /dev/null + +if [ ! "$#" -eq 0 ] && [ ! "$#" -eq 2 ]; then + echo "Usage: ./build.sh " + echo + echo "e.g.:" + echo " ./build.sh 3.4.4-stable true" + echo " ./build.sh master master" + echo + echo "If no arguments are given" + read version + exit 1 +fi + +if [ "$#" -eq 0 ] && [ ! -d ../godot ]; then + echo "No Godot clone found. Run ./build.sh first." + exit 1 +fi + +branch=${1%/} +if [ "${2}" = "true" ]; then +target="target=debug" +else +target="" +fi + +pushd .. +echo `pwd` +if [ ! -z "$branch" ]; then + rm -rf godot + git clone --depth 1 https://github.com/godotengine/godot.git -b $branch + if [ "${2}" = "true" ]; then + cp -r .idea godot + cp build/custom.py godot + rm -rf example/.import + rm -rf example/.godot + fi +fi +cp -r ../spine-cpp/spine-cpp spine_godot +popd + + +pushd ../godot +scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" -j16 +if [ `uname` == 'Darwin' ]; then + scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" -j16 + lipo -create bin/godot.osx.tools.x86_64 bin/godot.osx.tools.arm64 -output bin/godot.osx.tools.universal + strip -S -x bin/godot.osx.tools.universal +fi +popd + +popd > /dev/null \ No newline at end of file diff --git a/spine-godot/custom.py b/spine-godot/build/custom.py similarity index 100% rename from spine-godot/custom.py rename to spine-godot/build/custom.py diff --git a/spine-godot/livepp-v4.patch b/spine-godot/build/livepp-v4.patch similarity index 100% rename from spine-godot/livepp-v4.patch rename to spine-godot/build/livepp-v4.patch diff --git a/spine-godot/livepp.patch b/spine-godot/build/livepp.patch similarity index 100% rename from spine-godot/livepp.patch rename to spine-godot/build/livepp.patch diff --git a/spine-godot/setup.bat b/spine-godot/build/setup.bat similarity index 100% rename from spine-godot/setup.bat rename to spine-godot/build/setup.bat diff --git a/spine-godot/setup.sh b/spine-godot/setup.sh deleted file mode 100755 index 76ff16f5b..000000000 --- a/spine-godot/setup.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -if [ "$#" -eq 0 ]; then - echo "Usage: ./setup.sh " - echo - echo "e.g.:" - echo " ./setup.sh 3.4.4-stable" - echo " ./setup.sh master" - read version - exit 1 -fi - -branch=${1%/} - -rm -rf godot -git clone --depth 1 https://github.com/godotengine/godot.git -b $branch -cp -r .idea godot -cp custom.py godot -cp -r ../spine-cpp/spine-cpp spine_godot -rm -rf example/.import -rm -rf example/.godot -./build.sh \ No newline at end of file