LLVM生成离线官方HTML文档教程
上官网,找到并下载你所要的LLVM源码。
生成离线官方HTML文档需要下载一些组件,我所用的ubuntu18.04.03,其他linux发行版方法类似:
使用pip安装Sphinx和recommonmark组件。这两个组件依赖的包较多,如果你嫌弃默认的pip源的下载速度太慢,可以配置阿里的pip源。具体配置方法参考网址。
ubuntu系统上,pip安装Sphinx和recommonmark组件的命令如下:
sudo apt install python-pip -y
pip install -U Sphinx
pip install recommonmark
等待安装完以上组件。
然后执行以下命令生成HTML文档
#!/bin/bash
llvm_src_dir=$1
if [ -z $1 ] || [ ! -d ${llvm_src_dir} ]; then
echo "[E]>>can not find directory: ${llvm_src_dir}"
exit 1
fi
cd ${llvm_src_dir}/..
echo `pwd`
rm -fR llvm_official_docs_html
mkdir llvm_official_docs_html
cd llvm_official_docs_html
# It's very import to add -DSPHINX_WARNINGS_AS_ERRORS=OFF option when creating cmake-project, otherwise, there are large of ERROR taking place when generation going on.
cmake -DLLVM_ENABLE_SPHINX=true -DSPHINX_OUTPUT_HTML=true -DSPHINX_WARNINGS_AS_ERRORS=OFF ${llvm_src_dir}/llvm
make -j3 docs-llvm-html # generate llvm docs
make -j3 docs-clang-html # generate clang docs