build.sh 1.2 KB
Newer Older
1
#!/bin/bash
Z
zenghsh3 已提交
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

if [ $# != 1 ]; then
  echo "You must choose one framework (paddle/torch) to compile DeepES."
  exit 0
fi

if [ $1 = "paddle" ]; then
  #---------------paddlelite-------------#
  if [ ! -d "./inference_lite_lib" ];then
    echo "Cannot find the PaddleLite library: ./inference_lite_lib"
    echo "Please put the PaddleLite libraray to current folder according the instruction in README"
    exit 1
  fi

  FLAGS=" -DWITH_PADDLE=ON"
elif [ $1 = "torch" ]; then
  #---------------libtorch-------------#
  if [ ! -d "./libtorch" ];then
    echo "Cannot find the torch library: ./libtorch"
    echo "Please put the torch libraray to current folder according the instruction in README"
    exit 1
  fi
  FLAGS=" -DWITH_TORCH=ON"
else
  echo "Invalid arguments. [paddle/torch]"
  exit 0
fi

#export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
31 32 33 34 35 36

#----------------protobuf-------------#
cp ./src/proto/deepes.proto ./
protoc deepes.proto --cpp_out ./
mv deepes.pb.h ./include
mv deepes.pb.cc ./src
Z
zenghsh3 已提交
37
rm deepes.proto
38 39

#----------------build---------------#
Z
zenghsh3 已提交
40
echo ${FLAGS}
41 42 43
rm -rf build
mkdir build
cd build
Z
zenghsh3 已提交
44
cmake ../ ${FLAGS}
45
make -j10
Z
zenghsh3 已提交
46 47

#-----------------run----------------#
48
./parallel_main