问题描述
我正在处理一个使用多个库的项目,该库的结构如下:
I'm working on a project that uses multiple libraries, set up in a structure like so:
/ src
/ libs / libOne
/ libs / libTwo
/src
/libs/libOne
/libs/libTwo
我想生成一个Doxygen页面,其中包含我的所有代码以及库。通过将Doxygen指向根,这非常简单。但是,我希望将doxygen输出分组,以便可以清楚地看到每个类/文件属于哪个库。但是,由于这些库不是我写的,所以我不想更改它们以添加\addtogroup注释。
I want to generate a single Doxygen page which covers all my code as well as the libraries. This was quite simple by just pointing Doxygen at the root. However, I want the doxygen output to be grouped so I can clearly see which library each class/file belongs to. However, since the libraries are not written by me I don't want to change them to add \addtogroup comments.
我不介意所生成的文档是否是低于图书馆的标准(例如,如果它们不包含与doxy兼容的注释),我仍然希望它们包含在内,以便我可以查看调用图并快速浏览类,等等。
I don't mind if the produced documentation is subpar for the libraries (for example if they don't include doxy compatible comments), I still want them included so I can view call graphs, and quickly browse the classes, etc.
如何在不更改库源代码的情况下将每个库代码分组为模块?
How can I group each libraries code into modules without changing the libraries' source?
谢谢
推荐答案
您应该将所有必要的文档放在外部文件中。我不知道该怎么做,但是我尝试设置一个像您这样的最小环境,并且效果很好。只是为了记录一些东西,我已经在Doxygen网站上获取了示例代码:
You should put all the necessary documentation in external files. I didn't know how to do this, but I've tried to set up a minimal environment like yours and it worked well. Just for documenting something I've grabbed the example code on the Doxygen site:
test1.h:
#define MAX(a,b) (((a)>(b))?(a):(b))
typedef unsigned int UINT32;
int errno;
int open(const char *,int);
int close(int);
size_t write(int,const char *, size_t);
int read(int,char *,size_t);
并编写了完全无用的test2.h(只是有两个不同的文件...): / p>
and wrote the totally useless test2.h (just to have two different files...):
void itdoesnothing();
这里是不错的部分。我已经为记录上述内容制作了一个外部标头,称为test_doc.h(再次,仅使用了Doxygen网站上的示例):
Here comes the nice part. I've made an external header just for documenting the above, called it test_doc.h (again, just used the example on the Doxygen site):
/*! \addtogroup everything The main group
This group contains everything.
@{
*/
/*! \file test.h
\brief A Documented file.
Details.
*/
/*! \def MAX(a,b)
\brief A macro that returns the maximum of \a a and \a b.
Details.
*/
/*! \var typedef unsigned int UINT32
\brief A type definition for a .
Details.
*/
/*! \addtogroup err Error handling
Error handling related stuff
@{
*/
/*! \var int errno
\brief Contains the last error code.
\warning Not thread safe!
*/
/*! @} */
/*! \addtogroup fdrelated File description related
File descriptor related stuff.
@{
*/
/*! \fn int open(const char *pathname,int flags)
\brief Opens a file descriptor.
\param pathname The name of the descriptor.
\param flags Opening flags.
*/
/*! \fn int close(int fd)
\brief Closes the file descriptor \a fd.
\param fd The descriptor to close.
*/
这成功记录了Doxygen的两个文件。您也可以通过这种方式对文件,名称空间等进行分组,如手册中所述:
This successfully documented both files for Doxygen. This way you can group files, namespaces etc. too, as stated in the manual:
因此请尝试阅读并查看如何处理我已经做过的事情上文提到的。祝你好运!
So try reading http://www.doxygen.nl/grouping.html too and see what's possible to do with the things I've mentioned above. Good luck!
这篇关于如何管理具有多个库的Doxygen项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!