-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
setup.sh
executable file
·136 lines (118 loc) · 2.53 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
# Constants
BUILD_FOLDER="$(pwd)"/build
aptInstall() {
sudo apt install -y "$1"
}
pacmanInstall() {
pacman -S "$1"
}
brewInstall() {
brew install "$1"
}
copyResources() {
# Move files from res/ to build/
echo "Moving files..."
if [ ! -f "$BUILD_FOLDER"/config.json ]; then
cp -a "$(pwd)"/res/* "$BUILD_FOLDER"
cp -a "$(pwd)"/res/* "$BUILD_FOLDER"
cd ..
fi
if [ ! -f "$BUILD_FOLDER"/config.json ]; then
echo "Failed"
exit
fi
cd "$BUILD_FOLDER" || exit
}
standalone() {
echo "Making AviTab-standalone..."
copyResources
make AviTab-standalone
}
plugin() {
echo "Making avitab_plugin..."
copyResources
make avitab_plugin
}
# OS Detection
case "$OSTYPE" in
linux*)
echo "Linux detected..."
aptInstall cmake
aptInstall make
aptInstall autoconf
aptInstall automake
aptInstall libtool
aptInstall libglfw3
aptInstall libglfw3-dev
aptInstall uuid-dev
;;
msys*)
echo "Windows detected..."
echo "Have you installed MSYS2?"
printf "1. Yes\n2. No\n"
read -r answer
if [ "$answer" == "1" ]; then
pacmanInstall mingw-w64-x86_64-toolchain
pacmanInstall mingw64/mingw-w64-x86_64-cmake
pacmanInstall msys/git
pacmanInstall msys/patch
pacmanInstall msys/make
pacmanInstall msys/autoconf
pacmanInstall msys/automake
pacmanInstall msys/libtool
pacmanInstall mingw64/mingw-w64-x86_64-glfw
elif [ "$answer" == "2" ]; then
echo "Please download it from: https://www.msys2.org/ and install it, then run this script again."
exit
else
echo "Exiting..."
exit
fi
;;
darwin*)
echo "macOS detected..."
echo "Have you installed brew?"
printf "1. Yes\n2. No\n"
read -r answer
if [ "$answer" == "1" ]; then
brewInstall cmake
brewInstall make
brewInstall autoconf
brewInstall automake
brewInstall libtool
brewInstall glfw
brewInstall pkgconfig
elif [ "$answer" == "2" ]; then
echo "Please download it from: https://brew.sh/ and install it, then run this script again."
exit
else
echo "Exiting..."
exit
fi
;;
*)
echo "Unkown system, exiting..."
exit
;;
esac
# Build third party dependencies in the build-third directory
echo "Running build_dependencies..."
./build_dependencies.sh
# Setup build folder properly
echo "Running CMake..."
cmake -G 'Unix Makefiles' -B "$BUILD_FOLDER"
echo "Select next step..."
printf "1. Make AviTab-Standalone\n2. Make avitab-plugin\n3. Nothing\n"
read -r selection
case "$selection" in
1)
standalone
;;
2)
plugin
;;
*)
echo "Exiting..."
;;
esac