Doxygen系列学习二--入门

可执行文件doxygen是解析源代码并生成文档的主程序。(安装后就会出现)
下图显示了工具和它们之间的信息流之间的关系((it looks complex but that’s only because it tries to be complete):
这里写图片描述

第0步:检查doxygen是否支持您的编程语言:

首先,确保你的编程语言有被doxygen识别的合理机会。默认情况下支持这些语言:C,C ++,C#,Objective-C,IDL,Java,VHDL,PHP,Python,Tcl,Fortran和D.可以配置某些文件类型扩展以使用某些解析器:配置/ ExtensionMappings的细节。另外,使用预处理器程序可以支持完全不同的语言:有关详细信息,请参阅帮助页面。

第1步:创建配置文件

Doxygen使用配置文件来确定其所有设置。每个项目都应该有自己的配置文件。项目可以由单个源文件组成,但也可以是递归扫描的整个源树。
为了简化配置文件的创建,doxygen可以为你创建一个模板配置文件。doxygen使用以下-g选项从命令行执行此调用:

doxygen -g <config-file>

其中是配置文件的名称。如果您省略文件名称,Doxyfile将创建一个名为的文件。如果名称的文件已经存在,那么在生成配置模板之前,doxygen会将其重命名为 .bak。如果你使用-(即减号)作为文件名,那么doxygen会尝试从标准输入(stdin)中读取配置文件,这对脚本编写很有用。
配置文件的格式与(简单)Makefile相似。它由以下形式的许多分配(标签)组成:
TAGNAME = VALUE 要么
TAGNAME = VALUE1 VALUE2 …

If you have a larger project consisting of a source directory or tree you should assign the root directory or directories to the INPUT tag, and add one or more file patterns to the FILE_PATTERNS tag (for instance .cpp .h). Only files that match one of the patterns will be parsed (if the patterns are omitted a list of typical patterns is used for the types of files doxygen supports). For recursive parsing of a source tree you must set the RECURSIVE tag to YES. To further fine-tune the list of files that is parsed the EXCLUDE and EXCLUDE_PATTERNS tags can be used. To omit all test directories from a source tree for instance, one could use:

EXCLUDE_PATTERNS = */test/* 

Doxygen looks at the file’s extension to determine how to parse a file, using the following table:
这里写图片描述

第2步:运行doxygen

要生成文档,您现在可以输入:

doxygen <config-file>

The default output directory is the directory in which doxygen is started. The root directory to which the output is written can be changed using the OUTPUT_DIRECTORY. The format specific directory within the output directory can be selected using the HTML_OUTPUT, RTF_OUTPUT, LATEX_OUTPUT, XML_OUTPUT, MAN_OUTPUT, and DOCBOOK_OUTPUT. tags of the configuration file. If the output directory does not exist, doxygen will try to create it for you (but it will not try to create a whole path recursively, like mkdir -p does).

步骤3:记录来源

Although documenting the sources is presented as step 3, in a new project this should of course be step 1. Here I assume you already have some code and you want doxygen to generate a nice document describing the API and maybe the internals and some related design documentation as well.

猜你喜欢

转载自blog.csdn.net/qq_16481211/article/details/80376293