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
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"
}


case "$1" in
    "with_docker")
Q
qijun 已提交
14
        docker run --rm -v $PWD/../../../../:/paddle \
Q
qijun 已提交
15 16 17
            -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_DOC=ON" paddledev/paddle:dev
        ;;
    "local")
Q
qijun 已提交
18 19 20
        mkdir -p doc
        mkdir -p doc_cn
        PADDLE_SOURCE_DIR=$PWD/../../../../
Q
qijun 已提交
21 22 23 24
        mkdir -p $PADDLE_SOURCE_DIR/build_doc
        pushd $PADDLE_SOURCE_DIR/build_doc
        cmake .. -DWITH_DOC=ON
        make paddle_docs paddle_docs_cn
Q
qijun 已提交
25 26
        cp -r $PADDLE_SOURCE_DIR/build_doc/doc/en/html/* doc
        cp -r $PADDLE_SOURCE_DIR/build_doc/doc/cn/html/* doc_cn
Q
qijun 已提交
27 28 29 30 31 32 33 34 35 36
        popd
        rm -rf $PADDLE_SOURCE_DIR/build_doc
        ;;
    "--help")
        usage
        ;;
    *)
        usage
        ;;
esac