-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·64 lines (52 loc) · 1.4 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
#!/bin/bash
############################################
# enviroment variables
############################################
export MAKE_DEBUG_MODE=0
export ONLY_MAKE=0
export ONLY_CMAKE=0
for par in $@
do
if [ $par == "debug" ]; then
MAKE_DEBUG_MODE=1
fi
if [ $par == "make" ]; then
ONLY_MAKE=1
fi
if [ $par == "cmake" ]; then
ONLY_CMAKE=1
fi
done
export BIN_DIRECTORY=${PWD}/bin
export LIBRARY_DIRECTORY=${PWD}/lib
export BUILD_DIRECTORY=${PWD}/build
export CMAKE_TOOLS_DIR=${PWD}/cmake-tools
#export CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=/usr/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/bin/gcc-4.8"
export PREF_FLAG="-O2"
if [ $MAKE_DEBUG_MODE -eq 1 ]; then
PREF_FLAG="-g"
fi
export CXX_FLAGS="$PREF_FLAG -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-write-strings -std=c++11 -Wno-literal-suffix"
export C_FLAGS="$PREF_FLAG -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-write-strings" #-std=c99
############################################
# cmake
############################################
rm -rf $BIN_DIRECTORY; mkdir $BIN_DIRECTORY;
if ! [ -d $BUILD_DIRECTORY ]; then
mkdir $BUILD_DIRECTORY
ONLY_MAKE=0
fi
cd $BUILD_DIRECTORY;
if [ $ONLY_MAKE -eq 0 ]; then
cmake $CMAKE_FLAGS ../
fi
############################################
# make
############################################
if [ $ONLY_CMAKE -eq 0 ]; then
if [ $MAKE_DEBUG_MODE -eq 1 ]; then
make
else
make -j4
fi
fi