-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathbuild_linux_premake.sh
71 lines (58 loc) · 1.45 KB
/
build_linux_premake.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
#!/usr/bin/env bash
function help_page () {
echo "./$(basename "$0") [switches]"
echo "switches:"
echo " --deps: rebuild third-party dependencies"
echo " --help: show this page"
}
# use 70%
build_threads="$(( $(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 0) * 70 / 100 ))"
[[ $build_threads -lt 2 ]] && build_threads=2
BUILD_DEPS=0
for (( i=1; i<=$#; ++i )); do
arg="${!i}"
if [[ "$arg" = "--deps" ]]; then
BUILD_DEPS=1
elif [[ "$arg" = "--help" ]]; then
help_page
exit 0
else
echo "invalid arg $arg" 1>&2
exit 1
fi
done
premake_exe=./"third-party/common/linux/premake/premake5"
if [[ ! -f "$premake_exe" ]]; then
echo "preamke wasn't found" 1>&2
exit 1
fi
chmod 777 "$premake_exe"
# build deps
if [[ $BUILD_DEPS = 1 ]]; then
export CMAKE_GENERATOR="Unix Makefiles"
"$premake_exe" --file="premake5-deps.lua" --all-ext --all-build --64-build --32-build --verbose --clean --j=$build_threads --os=linux gmake2 || {
exit 1;
}
fi
"$premake_exe" --genproto --os=linux gmake2 || {
exit 1;
}
pushd ./"build/project/gmake2/linux"
# you can select individual or all
echo; echo building debug x64
make -j $build_threads config=debug_x64 || {
exit 1;
}
echo; echo building debug x32
make -j $build_threads config=debug_x32 || {
exit 1;
}
echo; echo building release x64
make -j $build_threads config=release_x64 || {
exit 1;
}
echo; echo building release x32
make -j $build_threads config=release_x32 || {
exit 1;
}
popd