【问题标题】:doxygen is generating empty documentationdoxygen 正在生成空文档
【发布时间】:2017-08-22 21:56:08
【问题描述】:

我在 C++(和一些 CUDA)中有一个 source repository,我想对它进行 doxygenate。我已将 doxygen cmets 添加到一些(但不是全部)代码中;生成了一个 Doxygen 配置文件,并使用它运行 doxygen 以查看部分输出。

我得到的是:什么都没有。空的。

生成了一个主页,但它没有显示任何内容 - 即使我专门设置了EXTRACT_ALL = YES(在使用EXTRACT_ALL = NO 得到空结果之后。

为什么什么都没有生成,我该如何解决?

注意事项:

  • 所有头文件都有@file cmets。
  • 我已将与 CUDA 相关的扩展添加到允许的模式中
  • 我有这个问题的早期版本,没有答案,之后情况发生了一些变化(所以我删除了那个)。
  • 即使从doxygen.cfg 中删除大部分行(见下文),问题仍然存在。


doxygen.cfg(更短的版本,过滤掉了 cmets):

DOXYFILE_ENCODING      = UTF-8
PROJECT_NAME           = "cuda-api-wrappers"
PROJECT_BRIEF          = "Thin C++-flavored wrappers for the CUDA Runtime API"
OUTPUT_DIRECTORY       = docs
ALLOW_UNICODE_NAMES    = YES
OUTPUT_LANGUAGE        = English
BRIEF_MEMBER_DESC      = YES
REPEAT_BRIEF           = YES
FULL_PATH_NAMES        = YES
JAVADOC_AUTOBRIEF      = YES
QT_AUTOBRIEF           = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS           = YES
SEPARATE_MEMBER_PAGES  = NO
TAB_SIZE               = 4
EXTENSION_MAPPING      = cu=C++ cuh=C++ cuhpp=C++ hpp=C++
MARKDOWN_SUPPORT       = YES
AUTOLINK_SUPPORT       = YES
BUILTIN_STL_SUPPORT    = YES
SUBGROUPING            = YES
LOOKUP_CACHE_SIZE      = 2
EXTRACT_ALL            = YES
EXTRACT_LOCAL_CLASSES  = YES
HIDE_UNDOC_MEMBERS     = NO
HIDE_UNDOC_CLASSES     = NO
HIDE_FRIEND_COMPOUNDS  = NO
CASE_SENSE_NAMES       = YES
HIDE_SCOPE_NAMES       = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES     = YES
SHOW_GROUPED_MEMB_INC  = NO
FORCE_LOCAL_INCLUDES   = NO
INLINE_INFO            = YES
SORT_MEMBER_DOCS       = YES
STRICT_PROTO_MATCHING  = NO
MAX_INITIALIZER_LINES  = 30
SHOW_USED_FILES        = YES
SHOW_FILES             = YES
SHOW_NAMESPACES        = YES
QUIET                  = NO
WARNINGS               = YES
WARN_IF_UNDOCUMENTED   = YES
WARN_IF_DOC_ERROR      = YES
WARN_NO_PARAMDOC       = NO
WARN_AS_ERROR          = NO
WARN_FORMAT            = "$file:$line: $text"
INPUT                  = src
INPUT_ENCODING         = UTF-8
FILE_PATTERNS          = *.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf, *.as *.js, *.cuh, *.cu, *.cuhpp
RECURSIVE              = YES

Doxygen 控制台输出:

Adding custom extension mapping: .cu will be treated as language c++
Adding custom extension mapping: .cuh will be treated as language c++
Adding custom extension mapping: .cuhpp will be treated as language c++
Adding custom extension mapping: .hpp will be treated as language c++
Searching for include files...
Searching for example files...
Searching for images...
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /home/eyalroz/src/mine/cuda-api-wrappers/src
Searching for files in directory /home/eyalroz/src/mine/cuda-api-wrappers/src/cuda
Searching for files in directory /home/eyalroz/src/mine/cuda-api-wrappers/src/cuda/api
Reading and parsing tag files
Parsing files
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Associating documentation with classes...
Computing nesting relations for classes...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Creating members for template instances...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Freeing entry tree
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
Inheriting documentation...
Generating disk names...
Adding source references...
Adding xrefitems...
Sorting member lists...
Computing dependencies between directories...
Generating citations page...
Counting data structures...
Resolving user defined references...
Finding anchors and sections in the documentation...
Transferring function references...
Combining using relations...
Adding members to index pages...
Generating style sheet...
Generating search indices...
Generating example documentation...
Generating file sources...
Generating file documentation...
Generating page documentation...
Generating group documentation...
Generating class documentation...
Generating namespace index...
Generating graph info page...
Generating directory documentation...
Generating index page...
Generating page index...
Generating module index...
Generating namespace index...
Generating namespace member index...
Generating annotated compound index...
Generating alphabetical compound index...
Generating hierarchical class index...
Generating graphical class hierarchy...
Generating member index...
Generating file index...
Generating file member index...
Generating example index...
finalizing index lists...
writing tag file...
Running dot...
lookup cache used 127/262144 hits=628 misses=194
finished...

【问题讨论】:

  • 发布您使用过的 Doxyfile (doxygen.cfg),因为它看起来不正确,链接不是上帝(可能会在不久的将来消失)。
  • 这是一个“为什么这段代码不起作用”的问题。这些问题应该有一个minimal reproducible example在问题本身
  • 看起来FILE_PATTERN中不应该有逗号(,),它是一个空格分隔的列表,现在逗号被添加到文件扩展名中。
  • @albert:就是这样!太棒了!...如果您愿意,请随时将其发布为答案,我会接受。
  • 我最近向 doxygen github 推送了一个提议的补丁(pull request 6563, github.com/doxygen/doxygen/pull/6563),这个补丁已经集成到 master.拉取请求是在列表中启用逗号。

标签: c++ doxygen code-documentation


【解决方案1】:

TL;DR:删除 FILE_PATTERNS 变量中的逗号并使其以空格分隔。

代替:

FILE_PATTERNS          = *.c, *.cc, *.cxx, *.etc

你应该使用:

FILE_PATTERNS          = *.c *.cc *.cxx *.etc

说明

@albert 是破解这个难题的人...

Doxygen 生成的配置文件说:

# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.

FILE_PATTERNS          = 

此注释具有误导性,因为它为您提供了一个以逗号分隔的列表,而实际上逗号不被视为分隔符。如果您使用该列表(并且可能添加/更改它),就像在 OP 的示例中一样,Doxygen 会看到一个模式列表,其扩展名具有尾随 , 字符。而且 - 它不会抱怨。它也不会抱怨忽略存储库中的所有文件 - 它只是以空结果结束。

删除, 字符会生成非空文档。

注意:从 Doxygen 版本 1.8.15 开始,这应该不再是问题,并且应该接受逗号作为字段的分隔符。

【讨论】:

  • 我最近向 doxygen github 推送了一个提议的补丁(拉取请求 6563,github.com/doxygen/doxygen/pull/6563),这已集成到 master.xml 中。拉取请求是在列表中启用逗号。
  • @albert:你能告诉我们哪个 doxygen 版本是第一个集成你的补丁的版本吗?
  • 从发布日期到集成日期,这给出了版本 1.8.15。在查看更改日志(doxygen.nl/manual/changelog.html)并搜索拉取请求的文本“在配置列表中启用逗号作为分隔符”时,这也给出了 1.8.15
  • @albert 哇!现在是 2021 年,Ubuntu 16.04 上的 sudo apt-get install doxygen 给了我 Doxygen version 1.8.11 !!然后sudo apt-get update 重复sudo apt-get install doxygen 导致doxygen is already the newest version (1.8.11-1ubuntu0.1).。不过,现在我看到了您的修订历史记录,1.8.15 似乎仅在 2020 年才添加到您的答案中,所以这还不错。
  • @user1271772:您确实意识到 Ubuntu 16.04 包含 2016 年的软件,而且可能很多是 2015 年末的软件,对吧? ......这将在 2022 年、2023 年和永远如此:-P