11 pushd build &>/dev/null
13 while getopts p: flag; do
24 # make sure argument is lowercase
25 OPTION="$(echo "$1" | tr '[A-Z]' '[a-z]')"
28 echo build.sh - build debug library
29 echo build.sh clean - clean the build
30 echo build.sh release - build release library
31 echo build.sh -p ios release - build release ios library
32 echo build.sh -p android release - build release android library
36 if [ "$OPTION" = 'help' ]; then
40 echo "Building Rive for platform=$platform option=$OPTION"
41 PREMAKE="premake5 gmake2 $1"
43 if [ "$OPTION" = "clean" ]; then
45 make clean config=release
46 elif [ "$OPTION" = "release" ]; then
47 make config=release -j7
55 echo "Building for iOS"
56 export IOS_SYSROOT=$(xcrun --sdk iphoneos --show-sdk-path)
58 export IOS_SYSROOT=$(xcrun --sdk iphonesimulator --show-sdk-path)
59 build "--os=ios --variant=emulator"
60 if [ "$OPTION" = "clean" ]; then
64 # Android supports ABIs via a custom platform format:
65 # e.g. 'android.x86', 'android.x64', etc.
67 echo "Building for ${platform}"
68 # Extract ABI from this opt by splitting on '.' character
69 IFS="." read -ra strarr <<<"$platform"
71 build "--os=android --arch=${ARCH}"