mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
fc21578f24
Former-commit-id: 2726bed199c8921f1ba6850777125d609790841e
83 lines
1.6 KiB
Bash
Executable File
83 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
BUILD_TYPE="Debug"
|
|
BUILD_UNITTEST="off"
|
|
BUILD_GPU="OFF"
|
|
INSTALL_PREFIX=$(pwd)/megasearch
|
|
MAKE_CLEAN="OFF"
|
|
|
|
while getopts "p:t:uhgr" arg
|
|
do
|
|
case $arg in
|
|
t)
|
|
BUILD_TYPE=$OPTARG # BUILD_TYPE
|
|
;;
|
|
u)
|
|
echo "Build and run unittest cases" ;
|
|
BUILD_UNITTEST="on";
|
|
;;
|
|
p)
|
|
INSTALL_PREFIX=$OPTARG
|
|
;;
|
|
g)
|
|
BUILD_GPU="ON"
|
|
;;
|
|
r)
|
|
if [[ -d cmake_build ]]; then
|
|
rm ./cmake_build -r
|
|
MAKE_CLEAN="ON"
|
|
fi
|
|
;;
|
|
h) # help
|
|
echo "
|
|
|
|
parameter:
|
|
-t: build type
|
|
-u: building unit test options
|
|
-p: install prefix
|
|
-g: build GPU version
|
|
-r: remove previous build directory
|
|
|
|
usage:
|
|
./build.sh -t \${BUILD_TYPE} [-u] [-h] [-g] [-r]
|
|
"
|
|
exit 0
|
|
;;
|
|
?)
|
|
echo "unknown argument"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ ! -d cmake_build ]]; then
|
|
mkdir cmake_build
|
|
MAKE_CLEAN="ON"
|
|
fi
|
|
|
|
cd cmake_build
|
|
|
|
CUDA_COMPILER=/usr/local/cuda/bin/nvcc
|
|
|
|
if [[ ${MAKE_CLEAN} = "ON" ]]; then
|
|
CMAKE_CMD="cmake -DBUILD_UNIT_TEST=${BUILD_UNITTEST} \
|
|
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}
|
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
|
-DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} \
|
|
-DGPU_VERSION=${BUILD_GPU} \
|
|
$@ ../"
|
|
echo ${CMAKE_CMD}
|
|
|
|
${CMAKE_CMD}
|
|
make clean
|
|
fi
|
|
|
|
make -j 4 || exit 1
|
|
|
|
if [[ ${BUILD_TYPE} != "Debug" ]]; then
|
|
strip src/vecwise_server
|
|
fi
|
|
|
|
make install
|
|
|