-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_example.sh
More file actions
executable file
·54 lines (46 loc) · 1.06 KB
/
run_example.sh
File metadata and controls
executable file
·54 lines (46 loc) · 1.06 KB
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
#!/bin/sh
source ./shell_colors.sh
list_examples() {
echo "==========================="
echo "List of examples:"
ls examples
}
if [ "$#" -ne "1" ]
then
echo "==========================="
echoColor $RED "You need to specify the example to run i.e. ./run_example.sh <example's name>"
list_examples
exit
fi
if [ ! -d "examples/$1" ]
then
echo "==========================="
echoColor $RED "Example '$1' does not exist."
list_examples
exit
fi
if [ ! -f /usr/lib/librgl.so ]
then
echoColor $YELLOW "Your machine doesn't have RGL installed, going to build it now."
./build_rgl.sh
if [ $? -ne 0 ]
then
exit 1
fi
fi
echo "==========================="
echo "Comiling example $1..."
pushd examples/$1
make
if [ $? -ne 0 ]
then
echo "==========================="
echoColor $RED "Failed to compile example '$1', please submit a bug report to https://github.com/rxtthin/rgl/issues"
else
echo "==========================="
echoColor $GREEN "Example $1 compiled successfully..."
echoColor $GREEN "Running example $1..."
echo "==========================="
./$1
fi
popd