Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / skia / renderer / build.sh
1 #!/bin/bash
2 set -e
3
4 # build main rive
5 cd ../..
6 ./build.sh "$@"
7
8 # build skia renderer
9 cd skia/renderer
10
11 pushd build &>/dev/null
12
13 while getopts p: flag; do
14     case "${flag}" in
15     p)
16         shift 2
17         platform=${OPTARG}
18         ;;
19
20     \?) help ;;
21     esac
22 done
23
24 # make sure argument is lowercase
25 OPTION="$(echo "$1" | tr '[A-Z]' '[a-z]')"
26
27 help() {
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
33     exit 1
34 }
35
36 if [ "$OPTION" = 'help' ]; then
37     help
38 else
39     build() {
40         echo "Building Rive for platform=$platform option=$OPTION"
41         PREMAKE="premake5 gmake2 $1"
42         eval "$PREMAKE"
43         if [ "$OPTION" = "clean" ]; then
44             make clean
45             make clean config=release
46         elif [ "$OPTION" = "release" ]; then
47             make config=release -j7
48         else
49             make -j7
50         fi
51     }
52
53     case $platform in
54     ios)
55         echo "Building for iOS"
56         export IOS_SYSROOT=$(xcrun --sdk iphoneos --show-sdk-path)
57         build "--os=ios"
58         export IOS_SYSROOT=$(xcrun --sdk iphonesimulator --show-sdk-path)
59         build "--os=ios --variant=emulator"
60         if [ "$OPTION" = "clean" ]; then
61             exit
62         fi
63         ;;
64     # Android supports ABIs via a custom platform format:
65     #   e.g. 'android.x86', 'android.x64', etc.
66     android*)
67         echo "Building for ${platform}"
68         # Extract ABI from this opt by splitting on '.' character
69         IFS="." read -ra strarr <<<"$platform"
70         ARCH=${strarr[1]}
71         build "--os=android --arch=${ARCH}"
72         ;;
73     *)
74         build
75         ;;
76     esac
77 fi
78
79 popd &>/dev/null