-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·60 lines (47 loc) · 1.04 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
build()
{
if [ $# -lt 1 ]; then
return
fi
DIR=build/$1
DEST_DIR=../../unity/Library/$1/
BUILD_ARGS="-DOPUS_BUILD_SHARED_LIBRARY=ON"
FILE_LIST="Release/opus.dll libopus.so"
if [ "$2" != "" ]; then
BUILD_ARGS="${BUILD_ARGS} -A $2"
fi
mkdir -p $DIR
cd $DIR
cmake ../../libopus $BUILD_ARGS
cmake --build . --config Release
for file in $FILE_LIST; do
test -f "$file" && cp "$file" $DEST_DIR
done
cd ../../
}
build_android()
{
if [ "$ANDROID_SDK_ROOT" = "" ]; then
echo "Android SDK is not found, skip android build."
return
fi
FILE_NAME="libopus/build/outputs/aar/libopus-release.aar"
cd android
if [ -x "$(command -v gradle)" ]; then
gradle build
else
./gradlew build
fi
test -f $FILE_NAME && cp $FILE_NAME ../unity/Library/android/
}
OS=`uname -o`
echo "OS: $OS"
if [ "$OS" = "GNU/Linux" ]; then
build linux
fi
if [ "$OS" = "Msys" ]; then
build win-x86 Win32
build win-x64 x64
fi
build_android