Skip to content

Commit

Permalink
Added build script and simulator support. Closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
devolonter committed Oct 9, 2021
1 parent cc1a2e4 commit c6c5beb
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ __pycache__
*.a
*.xcuserstate
godot_apple_signin.xcodeproj/xcuserdata/*
.idea
.sconsign.dblite
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ func _on_credential_error(result):
## Requirements

Sign in with Apple capability

## Build from source

Just run
`scripts/build.sh -v 3.3.4-stable` where -v is desired Godot version. Binaries were placed in bin directory and ready to
use plugin archive in dist directory
File renamed without changes.
Empty file added dist/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion godot
Submodule godot updated 931 files
33 changes: 33 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

name=libgodot_apple_signin
version=3.3.4-stable
declare -a targets=("release" "release_debug")

while getopts v: flag
do
case "${flag}" in
v) version=${OPTARG};;
*) echo "default version is $version";;
esac
done
cd ./godot || exit
git checkout "$version"
./../scripts/timeout.sh scons platform=iphone target=debug --jobs=$(sysctl -n hw.logicalcpu)
cd ../

for target in "${targets[@]}"
do
scons platform=ios arch=arm64 target="$target" target_name=$name version=3.2 --jobs=$(sysctl -n hw.logicalcpu)
scons platform=ios simulator=on arch=x86_64 target="$target" target_name=$name version=3.2 --jobs=$(sysctl -n hw.logicalcpu)

output="release"
if [ "$target" = "release_debug" ]; then
output="debug"
fi
lipo -create bin/$name.arm64-iphone."$target".a bin/$name.x86_64-simulator."$target".a -output bin/$name.$output.a
rm bin/$name.arm64-iphone."$target".a
rm bin/$name.x86_64-simulator."$target".a
done

zip dist/Prebuilt.plugin.for.Godot.v"$version".zip bin/$name.release.a bin/$name.debug.a ./godot_apple_signin.gdip
10 changes: 10 additions & 0 deletions scripts/timeout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
(
sleep 5

kill -s SIGTERM $$ && kill -0 $$ || exit 0
sleep 1
kill -s SIGKILL $$
) 2> /dev/null &

exec "$@"

0 comments on commit c6c5beb

Please sign in to comment.