forked from dmlc/minerva
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·96 lines (85 loc) · 2.53 KB
/
configure
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
#!/bin/bash
source configure.in
function unknown_option {
echo "Unknown option: $1"
echo "Run ./configure --help to get help"
exit 1
}
function run_clean {
read -n 1 -s -p "Are you sure to delete release/debug builds? [y/n]
" yesorno;
if [ "$yesorno" == "y" ]; then
echo "Removing release and debug builds"
rm -rf $RELEASE_DIR $DEBUG_DIR
fi
exit 0
}
CXXFLAGS="$CXXFLAGS \
-DCUDA_ROOT=$CUDA_ROOT \
-DEXTERN_LIB_PATH=$EXTERN_LIB_PATH \
-DEXTERN_INCLUDE_PATH=$EXTERN_INCLUDE_PATH"
DISABLE_PS=true
DISABLE_CUDA=false
while [ $# -gt 0 ]
do
case $1 in
--help | -h)
want_help=yes ;;
-c | --clean)
run_clean ;;
--disable-cuda)
DISABLE_CUDA=true; shift ;;
--enable-ps)
DISABLE_PS=false; shift ;;
--prefix=*)
CXXFLAGS="$CXXFLAGS -DCMAKE_INSTALL_PREFIX=`expr "x$1" : "x--prefix=\(.*\)"`"; shift ;;
-D)
CXXFLAGS="$CXXFLAGS -D$2=ON"; shift ;;
-D*)
CXXFLAGS="$CXXFLAGS -D`expr "x$1" : "x-D\(.*\)"`" ;;
*)
unknown_option $1 ;;
esac
shift
done
echo "DISABLE_PS=$DISABLE_PS"
if $DISABLE_PS -e true; then
CXXFLAGS="$CXXFLAGS -DDISABLE_PS=ON"
else
CXXFLAGS="$CXXFLAGS -DDISABLE_PS=OFF"
fi
if $DISABLE_CUDA -e true; then
CXXFLAGS="$CXXFLAGS -DDISABLE_CUDA=ON"
else
CXXFLAGS="$CXXFLAGS -DDISABLE_CUDA=OFF"
fi
#================================ help description =============================
if test "x$want_help" = xyes; then
cat <<EOF
Usage: ./configure [OPTION]...
Configurations:
-h, --help Display this help and exit
-c, --clean Clean up debug and release build
--disable-cuda Disable building with CUDA
--enable-pa Enable building with PS
--prefix Specify install path
-Dvar=value | -D value Specify definitions to be passed on to cmake
EOF
exit 0;
fi
#===============================================================================
#================================ main configuration =============================
echo -e "\n\n\n========================== Release =========================="
if [ ! -d $RELEASE_DIR ]; then
mkdir $RELEASE_DIR
fi
cd $RELEASE_DIR
CC=$C_COMPILER CXX=$CXX_COMPILER cmake -DCMAKE_BUILD_TYPE=Release $CXXFLAGS ..
cd ..
echo -e "\n\n\n========================== Debug =========================="
if [ ! -d $DEBUG_DIR ]; then
mkdir $DEBUG_DIR
fi
cd $DEBUG_DIR
CC=$C_COMPILER CXX=$CXX_COMPILER cmake -DCMAKE_BUILD_TYPE=Debug $CXXFLAGS ..
cd ..