build_docs.sh 1.1 KB
Newer Older
Y
Yu Yang 已提交
1 2
#!/bin/bash
set -e
Q
qijun 已提交
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
function usage(){
        echo "usage: build_doc [--help] [<args>]"
        echo "This script generates doc and doc_cn in the script's directory."
        echo "These are common commands used in various situations:"
        echo "    with_docker       build doc and doc_cn with docker"
        echo "    local             build doc and doc_cn locally"
}


MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PADDLE_SOURCE_DIR=$MYDIR/../../../../
case "$1" in
    "with_docker")
        docker run --rm -v $PADDLE_SOURCE_DIR:/paddle \
            -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_DOC=ON" paddledev/paddle:dev
        ;;
    "local")
        mkdir -p $MYDIR/doc
        mkdir -p $MYDIR/doc_cn
        mkdir -p $PADDLE_SOURCE_DIR/build_doc
        pushd $PADDLE_SOURCE_DIR/build_doc
        cmake .. -DWITH_DOC=ON
        make paddle_docs paddle_docs_cn
        cp -r $PADDLE_SOURCE_DIR/build_doc/doc/en/html/* $MYDIR/doc
        cp -r $PADDLE_SOURCE_DIR/build_doc/doc/cn/html/* $MYDIR/doc_cn
        popd
        rm -rf $PADDLE_SOURCE_DIR/build_doc
        ;;
    "--help")
        usage
        ;;
    *)
        usage
        ;;
esac