-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSETUP.sh
executable file
·91 lines (72 loc) · 2.7 KB
/
SETUP.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
script_failed() {
echo "SETUP.sh $1: \033[0;31mSCRIPT FAILED\033[0m";
exit 1;
}
mkdir -p build/CPP_Headers 2> /dev/null
option="${1}"
case ${option} in
all)
ninja build/TestCatch2;
./build/TestCatch2 || script_failed
ninja build/libMTBase64.so build/MTBase64.a || script_failed
cp MTBase64/MTBase64.hpp build/CPP_Headers/MTBase64.hpp
cp MTBase64/MTBase64.tcc build/CPP_Headers/MTBase64.tcc
rm build/TestCatch2 2> /dev/null
rm build/MTBase64.o 2> /dev/null
rm build/MTBase64.so.o 2> /dev/null
echo "SETUP.sh $1: \033[0;32mSCRIPT SUCCESS\033[0m";
echo "\033[1;33mbuild/CPP_Headers/MTBase64.hpp: Main header file\033[0m"
echo "\033[1;33mbuild/CPP_Headers/MTBase64.tcc: Template implementation file\033[0m"
echo "\033[1;33mbuild/libMTBase64.so: Shared library file\033[0m"
echo "\033[1;33mbuild/MTBase64.a: Static library file\033[0m"
exit 0
;;
clean)
ninja -t clean
rm -R build/CPP_Headers/* 2> /dev/null
echo "Cleaning... build/CPP_Headers"
exit 0
;;
static)
ninja build/TestCatch2;
./build/TestCatch2 || script_failed
ninja build/MTBase64.a || script_failed
cp MTBase64/MTBase64.hpp build/CPP_Headers/MTBase64.hpp
cp MTBase64/MTBase64.tcc build/CPP_Headers/MTBase64.tcc
rm build/TestCatch2 2> /dev/null
rm build/MTBase64.o 2> /dev/null
echo "SETUP.sh $1: \033[0;32mSCRIPT SUCCESS\033[0m";
echo "\033[1;33mbuild/CPP_Headers/MTBase64.hpp: Main header file\033[0m"
echo "\033[1;33mbuild/CPP_Headers/MTBase64.tcc: Template implementation file\033[0m"
echo "\033[1;33mbuild/MTBase64.a: Static library file\033[0m"
exit 0
;;
shared)
ninja build/TestCatch2;
./build/TestCatch2 || script_failed
ninja build/libMTBase64.so || script_failed
cp MTBase64/MTBase64.hpp build/CPP_Headers/MTBase64.hpp
cp MTBase64/MTBase64.tcc build/CPP_Headers/MTBase64.tcc
rm build/TestCatch2 2> /dev/null
rm build/MTBase64.so.o 2> /dev/null
rm build/MTBase64.o 2> /dev/null
echo "SETUP.sh $1: \033[0;32mSCRIPT SUCCESS\033[0m";
echo "\033[1;33mbuild/CPP_Headers/MTBase64.hpp: Main header file\033[0m"
echo "\033[1;33mbuild/CPP_Headers/MTBase64.tcc: Template implementation file\033[0m"
echo "\033[1;33mbuild/libMTBase64.so: Shared library file\033[0m"
exit 0
;;
help)
echo "SETUP.sh: List of all arguments:\n"
echo "\tall: Build both the static and shared library"
echo "\tstatic: Build only the static library file"
echo "\tshared: Build only the shared library file"
echo "\tclean: Remove all build files"
echo "\thelp: Show this list"
;;
*)
echo "$0: Wrong usage. Type 'SETUP.sh help' for more information."
exit 1
;;
esac