-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·98 lines (77 loc) · 2.08 KB
/
build.sh
File metadata and controls
executable file
·98 lines (77 loc) · 2.08 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
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
#!/bin/bash
set -e
function build_runMake() {
if [ -f "$(command -v nproc)" ]; then
threads=$(nproc --all)
echo "Building multithreaded ($threads)..."
make --jobs=$threads
else
echo "Building singlethreaded..."
make
fi
}
if [ -n "$1" ]; then
if [[ $1 == *"debug"* ]]; then
echo "Building debug..."
cd build
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Debug ../
build_runMake
cd ..
fi
if [[ "$1" == *"release"* ]]; then
echo "Building release..."
cd build
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release ../
build_runMake
cd ..
fi
if [[ "$1" == *"install"* ]]; then
echo "Installing TORASU-STUDIO..."
mkdir -p build
cd build
build_runMake
if [ $(uname) == "Darwin" ] || [ "$2" == "nosudo" ]; then
echo "Installing TORASU-STDUIO as user..."
make install
else
echo "Installing TORASU-STDUIO as super-user..."
sudo make install
fi
cd ..
fi
if [[ "$1" == *"wasm"* ]]; then
echo "Installing TORASU [WASM]..."
mkdir -p build/cross/wasm
cd build/cross/wasm
emcmake cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release ../../../
build_runMake
cd ../../..
fi
if [[ "$1" == *"wasmrun"* ]]; then
node ./wasm-test-server build/cross/wasm
fi
if [[ "$1" == *"delbuild"* ]]; then
echo "Deleting build-folder..."
rm -r build
fi
if [[ "$1" == *"help"* ]]; then
echo "Recieved arguments: \"$1\""
echo "Available arguments: "
echo " nosudo - Dont use sudo for installs"
echo " debug - Apply debug config"
echo " release - Apply release config"
echo " install - Installs current configuration"
echo " wasmbuild - Builds wasm-version into build/cross/wasm/"
echo " delbuild - Deletes all buld files (build/)"
echo "No arguments will just run a normal build."
echo "You can combine args as you wish, they are applied in the order listed above."
echo "(order they are written in the argument dont matter, as long as they are in the first argument)."
echo "For example \"install-release\" will build a release and install it afterwards."
fi
else
mkdir -p build
cd build
cmake -Wno-dev ../
make -j
cd ..
fi