-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·118 lines (101 loc) · 2.55 KB
/
install.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
if [ "$#" -ne 1 ]; then echo
echo "This script copies the shared library needed to use Axolote Engine"
echo "and paste into a path of your choice. It creates the folder"
echo "'resources' containing ONLY the shaders and creates the folder"
echo "'external' that has subfolders 'lib' and 'include'."
echo
echo "Usage: ./install.sh <path-to-install>"
exit 1
fi
path=$1
if [ ! -d "$path" ]; then
echo "target path not found"
exit 1
fi
# prompt to choose your build type
type=""
while true; do
echo "Choose your build type"
echo "Release [1]"
echo "Debug [2]"
echo "Exit script [3]"
read -p "Your choice: " option
case $option in
1 | 2 | 3) break ;;
*) echo -e "Invalid option\n" && sleep 1 ;;
esac
done
if [ $option = 1 ]; then
type="Release"
elif [ $option = 2 ]; then
type="Debug"
else
exit
fi
debug_output=""
while true; do
echo "Do you want to show debug output?"
echo "Yes [1]"
echo "No [2]"
echo "Exit script [3]"
read -p "Your choice: " option
case $option in
1 | 2 | 3) break ;;
*) echo -e "Invalid option\n" && sleep 1 ;;
esac
done
if [ $option = 1 ]; then
debug_output="On"
elif [ $option = 2 ]; then
debug_output="Off"
else
exit
fi
use_local_assimp=""
while true; do
echo "Do you want to use the local assimp library or the one installed"
echo "on your machine (via your package manager)?"
echo "Local [1]"
echo "Installed [2]"
echo "Exit script [3]"
read -p "Your choice: " option
case $option in
1 | 2 | 3) break ;;
*) echo -e "Invalid option\n" && sleep 1 ;;
esac
done
if [ $option = 1 ]; then
use_local_assimp="On"
elif [ $option = 2 ]; then
use_local_assimp="Off"
else
exit
fi
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake .. -DCMAKE_BUILD_TYPE=$type -DUSE_LOCAL_ASSIMP=$use_local_assimp -DDEBUG=$debug_output
make -j4
cd ..
echo
echo "Creating temporary folder"
mkdir tmp/external/lib/axolote -p
mkdir tmp/external/include -p
mkdir tmp/external/imgui -p
mkdir tmp/resources/shaders -p
echo "Copying content to temp folder"
cp build/lib/* tmp/external/lib/axolote/
cp external/lib/assimp/* tmp/external/lib/axolote/
cp -r external/imgui/* tmp/external/imgui/
cp -r include/axolote tmp/external/include/
cp -r resources/shaders/* tmp/resources/shaders
if [ $use_local_assimp = "Off" ]; then
# removing assimp libs
rm tmp/external/lib/axolote/libassimp*
fi
echo "Moving to target path: $path"
cp tmp/* -r $path
echo "Cleaning temp folder"
rm -rf tmp
exit 0