-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·99 lines (75 loc) · 2.21 KB
/
build.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
#!/bin/bash
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" == "install" ]; then
echo "Installing TORASU..."
mkdir -p build
cd build
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release ../
build_runMake
if [ $(uname) == "Darwin" ] || [ "$2" == "nosudo" ]; then
echo "Installing TORASU as user..."
make install
else
echo "Installing TORASU as super-user..."
sudo make install
fi
elif [ "$1" == "dbginstall" ]; then
echo "Installing TORASU [DEBUG]..."
mkdir -p build
cd build
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Debug ../
build_runMake
if [ $(uname) == "Darwin" ] || [ "$2" == "nosudo" ]; then
echo "Installing TORASU as user..."
make install
else
echo "Installing TORASU as super-user..."
sudo make install
fi
elif [ "$1" == "wasminstall" ]; then
echo "Installing TORASU [WASM]..."
mkdir -p build/cross/wasm
cd build/cross/wasm
emcmake cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release ../../../
build_runMake
echo "Installing wasm-artifacts..."
make install
elif [ "$1" == "delbuild" ]; then
echo "Deleting build-folder..."
rm -r build
elif [ "$1" == "wincross" ]; then
echo "Building cross via MinGW-CMake for windows"
mkdir -p build/cross/win/
cd build/cross/win/
x86_64-w64-mingw32-cmake -Wno-dev ../../../
build_runMake
elif [ "$1" == "delcross" ]; then
echo "Wiping cross build-folder..."
rm -r build/cross
else
echo "Unknown argument \"$1\"!"
echo "Available arguments: "
echo " install [nosudo] - Installs Libraries and Include files"
echo " dbginstall [nosudo] - Installs Libraries and Include files in debug-mode"
echo " wasminstall - Installs Libraries and Include files as web-assembly-artifacts"
echo " delbuild - Deletes all buld files (build/)"
echo " wincross - Builds windows binary into build/cross/win/"
echo " delcross - Removes cross build-folder (build/cross/)"
echo "No arguments will just run a normal build."
fi
else
mkdir -p build
cd build
cmake -Wno-dev ../
build_runMake
fi