-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·53 lines (46 loc) · 2.07 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
#!/bin/sh
# A simple incremental build script for android, desktop and web
# ./build.sh clean ; Remove all build folders (and so all the incremental builded objects)
# ./build.sh format ; Run the clang formatter over the whole c and cpp code base
# ./build.sh android ; Build and run a debug version of the Android application (change debug arch below)
# ./build.sh android release ; Build a release version of the Android app (all archs: aarch64 armv7a x86_64 x86)
# ./build.sh desktop ; Build and run a debug version of the desktop app
# ./build.sh desktop release ; Build a release version of the desktop app
# ./build.sh web ; Build a debug version of the WASM bundle (only with SIMD so only for Firefox and Chrome)
# ./build.sh web release ; Build a release version of the WASM bundle (for all browsers)
# Tip for web: If you run a webserver with live refresh you wont have to manually refresh the webbrowser
# https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer
export app_name="portablegl"
export app_package="com.example.portablegl"
export app_version="0.1.0"
export android_ndk_platform="darwin-x86_64" # Change this to your ANDROID_NDK_ROOT/toolchains/llvm/prebuilt folder name
export android_debug_arch="aarch64" # Change this x86_64 if you are debugging your app in a x86_64 Android simulator
if [[ $1 = "clean" ]]; then
rm -rf android/build desktop/build web/build
elif [[ $1 = "format" ]]; then
clang-format -i $(find . -name *.h -o -name *.c -o -name *.cpp)
elif [[ $1 = "android" ]]; then
if [[ $2 = "key" ]]; then
./android/build.sh key
elif [[ $2 = "log" ]]; then
./android/build.sh log
elif [[ $2 = "release" ]]; then
./android/build.sh release
else
./android/build.sh
fi
elif [[ $1 = "desktop" ]]; then
if [[ $2 = "release" ]]; then
./desktop/build.sh release
else
./desktop/build.sh
fi
elif [[ $1 = "web" ]]; then
if [[ $2 = "release" ]]; then
./web/build.sh release
else
./web/build.sh
fi
else
echo "Use one of the subcommands to do something..."
fi