如何交叉引用已经存在的 doxygen 文档?

rnd*_*gen 4 c++ documentation doxygen

我有两个 C++ 项目 A 和 B;依赖关系只是 B 到 A。

B  --> A
Run Code Online (Sandbox Code Playgroud)

我想分别在 A 和 B 上分别运行 Doxygen,但仍然让我可以从 B 文档中交叉引用 A。(也就是说,当我浏览 B 文档时,如果 B 中使用了来自 A 的任何类,我可以直接链接到 A 文档)。

——

[回复来自 0x4b 的答案:] 如果我将“CREATE_SUBDIRS”设置为 YES 并使用标签文件的相对路径,Doxygen 会以某种方式做出错误的链接引用。

我确实遵循了这个例子。

 <root>
    +- proj
    |   +- html               HTML output directory for proj   
    |       +- d1
    |       |   +- d2
    |       |       .... (*.html)
    |       | 
    |         ...(*.html)
    |   +- src                sources for proj
    +- ext1
    |   +- html               HTML output directory for ext1
    |   |- ext1.tag           tag file for ext1
    |- proj.cfg               doxygen configuration file for proj
    |- ext1.cfg               doxygen configuration file for ext1

proj.cfg:
OUTPUT_DIRECTORY  = proj
INPUT             = proj/src
TAGFILES          = ext1/ext1.tag=../../ext1/html

ext1.cfg:
OUTPUT_DIRECTORY  = ext1
GENERATE_TAGFILE  = ext1/ext1.tag 
Run Code Online (Sandbox Code Playgroud)

两者下的文档html/html/d1/d2想尝试链接位于../../ext1/html. 显然其中之一会失败。

Kir*_*sey 5

您可能想使用标记文件功能。为 A 生成文档时,请确保设置了 GENERATE_TAGFILE 选项。当您为 B 生成文档时,设置 TAGFILES 的值以包括来自 A 的结果。

[更新以解决相对路径]

Doxygen 在 [相对] 路径方面相当脆弱。您清楚地了解使用绝对路径可以解决问题。您可以尝试从环境中获取值,例如使用

TAGFILES          = ext1/ext1.tag=$(PWD)/../ext1/html
Run Code Online (Sandbox Code Playgroud)

创建绝对路径。这并不理想,但 Doxyfile 中的许多值取决于运行 doxygen 的位置,而不是配置文件所在的位置。