在read-the-docs中使用Doxygen

sol*_*nou 14 doxygen read-the-docs

我使用Doxygen和Markdown编写了一个中型C++软件的文档.我对它很满意,因为在更改了xml图层之后我得到了类似的内容:http: //docs.mitk.org/nightly/index.html

我想在线提供这些文档,理想情况下使用ReadtheDocs,其中文档将在"git commit"之后自动构建,并托管以进行浏览.

ReadtheDocs看起来像是理想的网站,但使用Sphinx和reStructuredText作为默认值.也可以使用Doxygen,但AFAIK只能通过呼吸.如果我不想将所有API文档转储到单个页面中,那么通过该路由本质上意味着我需要重新构建所有文档(http://librelist.com/browser//breathe/2011/8/6/fwd-guidance-for-usage-breathe-with-existing-doxygen-set-on-a-large-project /#cab3f36b1e4bb2294e2507acad71775f).

矛盾的是,Doxygen安装在read-the-docs服务器上,但在挣扎之后我找不到解决方法来跳过它的Sphinx或Mkdocs.

小智 8

我尝试了以下解决方案,在阅读文档时使用Doxygen,它似乎有效:

  1. 设置空狮身人面像项目(参考官方sphinx doc),
  2. 在sphinx conf.py中添加命令来构建doxygen文档,
  3. 使用conf.py html_extra_path配置指令覆盖生成的用于生成的sphinx文档的doxygen文档.

我用以下源代码树测试了这个:

.../doc/Doxyfile
       /build/html
       /sphinx/conf.py
       /sphinx/index.rst
       /sphinx/...
Run Code Online (Sandbox Code Playgroud)

一些解释:

  1. 在我的设置中,doxygen在"doc/build/html"中生成其文档,
  2. ReadTheDocs在找到conf.py文件的目录中运行其命令.

该怎么办:

  1. 在conf.py中添加以下行以生成doxygen文档:

     import subprocess
     subprocess.call('cd .. ; doxygen', shell=True)
    
    Run Code Online (Sandbox Code Playgroud)
  2. 将conf.py html_extra_path指令更新为:

     html_extra_path = ['../build/html']
    
    Run Code Online (Sandbox Code Playgroud)

在此配置中,ReadTheDocs应正确生成并存储Doxygen html文档.

去做:

  • 其他文档格式,例如:pdf.

  • 请务必查看此博客文章 https://devblogs.microsoft.com/cppblog/clear-function-c-documentation-with-sphinx-breathe-doxygen-cmake (2认同)