-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.lib.sh
70 lines (54 loc) · 1.46 KB
/
build.lib.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
#!/usr/bin/env bash
declare -r platform="$(uname -s)"
function action() {
local machine=$1
local make_path="$(which make)"
local clang_path="$(which clang)"
if [ "${clang_path}" == "" ]; then
clang_path="$(which cc)"
fi
if [ "${clang_path}" == "" ]; then
clang_path="$(which gcc)"
fi
local gpp_path="$(which g++)"
if [ "${gpp_path}" == "" ]; then
gpp_path="$(which c++)"
fi
if [ "${gpp_path}" == "" ]; then
gpp_path="$(which gcc)"
fi
echo "-----------------"
echo "${make_path}" "${clang_path}" ${gpp_path}
echo "-----------------"
if [[ -d "build" ]]; then
echo "remove "
rm -rf build
fi
mkdir build
cd build
# cmake -DCMAKE_MAKE_PROGRAM="${make_path}" -DCMAKE_C_COMPILER="${clang_path}" -DCMAKE_CXX_COMPILER=${gpp_path} -G "CodeBlocks - Unix Makefiles" ..
cmake -DCMAKE_MAKE_PROGRAM="/usr/bin/make" -DCMAKE_C_COMPILER="/usr/bin/clang" -DCMAKE_CXX_COMPILER="/usr/bin/gcc" -G "CodeBlocks - Unix Makefiles" ..
make
}
case "${platform}" in
Linux*)
echo "platform: Linux"
action "linux"
;;
MINGW*|MSYS*)
echo "platform: MingW or Msys"
action "msys"
;;
CYGWIN*)
echo "Machine: Cygwin"
action "cygwin"
;;
Darwin*)
echo "platform: Mac"
action "mac"
;;
*)
echo "platform: other Unix"
action "unix"
;;
esac