build.sh 1.1 KB
Newer Older
Z
zhangjinchao01 已提交
1 2 3 4 5 6 7 8 9 10
#!/bin/bash

function abort(){
    echo "An error occurred. Exiting..." 1>&2
    exit 1
}

trap 'abort' 0
set -e

Y
yuyang18 已提交
11 12
if [ ${WITH_GPU} == 'ON' ]; then
  ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so /usr/lib/libcudnn.so
Z
zhangjinchao01 已提交
13
fi
Y
yuyang18 已提交
14

15 16 17 18 19 20 21 22
mkdir -p /paddle/build # -p means no error if exists
cd /paddle/build
cmake .. \
      -DWITH_DOC=ON \
      -DWITH_GPU=${WITH_GPU} \
      -DWITH_AVX=${WITH_AVX} \
      -DWITH_SWIG_PY=ON \
      -DCUDNN_ROOT=/usr/ \
23 24
      -DWITH_STYLE_CHECK=OFF \
      -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
Z
zhangjinchao01 已提交
25 26 27
make -j `nproc`
make install

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
# Install woboq_codebrowser.
git clone https://github.com/woboq/woboq_codebrowser /woboq
cd /woboq
cmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \
      -DCMAKE_BUILD_TYPE=Release \
      .
make

export WOBOQ_OUT=/usr/share/nginx/html/paddle
export BUILD_DIR=/paddle/build
mkdir -p $WOBOQ_OUT
cp -rv /woboq/data $WOBOQ_OUT/../data
/woboq/generator/codebrowser_generator \
    -b /paddle/build \
    -a \
    -o $WOBOQ_OUT \
    -p paddle:/paddle
/woboq/indexgenerator/codebrowser_indexgenerator $WOBOQ_OUT
46 47 48
cd /woboq
make clean
rm -rf /paddle/build
Z
zhangjinchao01 已提交
49
trap : 0