-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·59 lines (54 loc) · 1.44 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
#!/bin/bash
# Determine the operating system and set the correct premake binary
if [ "$(uname)" = "Darwin" ]; then
premakeBinary="bin/premake5-mac"
elif [ "$(uname)" = "Linux" ]; then
premakeBinary="bin/premake5-linux"
else
echo "Unsupported operating system"
exit 1
fi
PrintHelp() {
echo "Usage:"
echo " ./build.sh compile [build_system] [configuration] [num_cores]"
echo " ./build.sh run [build_system] [configuration] [num_cores]"
echo ""
echo "Example:"
echo " ./build.sh compile gmake2 Release 8"
echo " ./build.sh run gmake2 Debug 4"
echo ""
echo "Parameters:"
echo " build_system: The build system to use (default: gmake2)"
echo " configuration: The build configuration (default: Debug)"
echo " num_cores: The number of cores to use for building (default: 4)"
echo ""
echo "Available build systems:"
$premakeBinary --help | awk '/ACTIONS/{flag=1; next} flag'
}
Compile() {
$premakeBinary "$buildSystem" || exit 1
cd build/"$buildSystem"
make CONFIG="$configuration" -j"$numCores" || exit 1
cd -
}
Run() {
Compile
# ./build/gmake2/bin/x86/Release/voxels
./build/"$buildSystem"/bin/arm64/Release/voxels
}
# Default values
buildSystem=${2:-gmake2}
configuration=${3:-Release}
numCores=${4:-4}
# Main script logic
case "$1" in
compile)
Compile
;;
run)
Run
;;
*)
PrintHelp
;;
esac