-
Notifications
You must be signed in to change notification settings - Fork 19
/
build_local.sh
111 lines (100 loc) · 2.34 KB
/
build_local.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
# Helpers
GREEN='\033[92m'
RED='\033[91m'
NC='\033[0m'
CYAN='\033[96m'
TICK="[${GREEN}✓${NC}]"
CROSS="[${RED}✗${NC}]"
INFO="[${CYAN}i${NC}]"
initializeSubmodules(){
# initialize submodules
echo "${GREEN}Initializing submodules${NC}"
git submodule update --recursive --init
git pull --recurse-submodules
}
buildAsn1c(){
# build asn1c
echo "${GREEN}Building asn1c${NC}"
cd ./usdot-asn1c
git reset --hard
git pull origin vlm_master
aclocal
test -f ./configure || autoreconf -iv
./configure
make
sudo make install
# get back to main directory
cd ../
}
buildPugiXml(){
# build pugixml
echo "${GREEN}Building pugixml${NC}"
cd ./pugixml
git pull origin master
mkdir build
cd build
cmake ..
make
sudo make install
# get back to main directory
cd ../..
}
compileSpecAndBuildLibrary(){
# Compile the Specifications and Build the Library
echo "${GREEN}Compile spec and build library${NC}"
cd ./asn1c_combined
./doIt.sh
# get back to main directory
cd ../
}
buildACM(){
# Build the ACM
echo "${GREEN}Building ACM${NC}"
if [ -d "./build" ]; then
echo "${INFO} Removing build directory"
rm -r build
fi
mkdir build
cd build
cmake ..
make
# get back to main directory
cd ../
}
runTests() {
# assumes everything has been built
cd ./build
./acm_tests
cd ../
}
runAll(){
# following from instructions in installation.md, this is the proper build order
initializeSubmodules
buildAsn1c
buildPugiXml
compileSpecAndBuildLibrary
buildACM
runTests
}
help(){
echo "Usage: ./build_local.sh [option]"
echo "Options:"
echo "${CYAN} -h, --help${NC}: Print this help message"
echo "${CYAN} -a, --asn1c${NC}: Build asn1c"
echo "${CYAN} -p, --pugi${NC}: Build pugi"
echo "${CYAN} -c, --compile${NC}: Compile the specifications and build the library"
echo "${CYAN} -b, --build${NC}: Build the ACM"
echo "${CYAN} -t, --test${NC}: Execute tests"
echo "${CYAN} -r, --run${NC}: Run all"
}
case "${1}" in
-h|--help) help ;;
-a|--asn1c) buildAsn1c ;;
-p|--pugi) buildPugiXml ;;
-c|--compile) compileSpecAndBuildLibrary ;;
-b|--build) buildACM ;;
-t|--test) runTests ;;
-r|--run) runAll ;;
*) runAll ;;
esac