cd doxygen
./configure
make
make install
from http://www.stack.nl/~dimitri/doxygen/download.html
http://www.stack.nl/~dimitri/doxygen/manual/install.html
http://www.stack.nl/~dimitri/doxygen/manual/index.html
http://freecode.com/projects/doxygen
http://sourceforge.net/projects/doxygen/
http://harmony.apache.org/subcomponents/drlvm/DoxygenStart.html
相关帖子:http://briteming.blogspot.com/2015/08/doxygen.html
-------
A more Pythonic version of doxypy, a Doxygen filter for Python.
doxypypy
A more Pythonic version of doxypy, a Doxygen filter for Python.Intent
For now Doxygen has limited support for Python. It recognizes Python comments, but otherwise treats the language as being more or less like Java. It doesn't understand basic Python syntax constructs like docstrings, keyword arguments, generators, nested functions, decorators, or lambda expressions. It likewise doesn't understand conventional constructs like doctests or ZOPE-style interfaces. It does however support inline filters that can be used to make input source code a little more like what it's expecting.The excellent doxypy makes it possible to embed Doxygen commands in Python docstrings, and have those docstrings converted to Doxygen-recognized comments on the fly per Doxygen's regular input filtering process. It however does not address any of the other previously mentioned areas of difficulty.
This project started off as a fork of doxypy but quickly became quite distinct. It shares little (if any) of the same code at this point (but maintains the original license just in case). It is meant to support all the same command line options as doxypy, but handle additional Python syntax beyond docstrings.
Additional Syntax Supported
Python can have functions and classes within both functions and classes. Doxygen best understands this concept via its notion of namespaces. This filter thus can supply Doxygen tags marking namespaces on every function and class. This addresses the issue of Doxygen merging inner functions' documentation with the documentation of the parent.Python class members whose names begin with a double-underscore are mangled and kept private by the language. Doxygen does not understand this natively yet, so this filter additionally provides Doxygen tags to label such variables as private.
Python frequently embeds doctests within docstrings. This filter makes it trivial to mark off such sections of the docstring so they get displayed as code.
ZOPE-style interfaces overload class definitions to be interface definitions, use embedded variable assignments to identify attributes, and use specific function calls to indicate interface adherence. Furthermore, they frequently don't have any code beyond their docstrings, so naively removing docstrings would result in broken Python. This filter has basic understanding of these interfaces and treats them accordingly, supplying Doxygen tags as appropriate.
Fundamentally Python docstrings are meant for humans and not machines, and ought not to have special mark-up beyond conventional structured text. This filter heuristically examines Python docstrings, and ones like the sample for complex in PEP 257 or that generally follow the stricter Google Python Style Guide will get appropriate Doxygen tags automatically added.
How It Works
This project takes a radically different approach than doxypy. Rather than use regular expressions tied to a state machine to figure out syntax, Python's own Abstract Syntax Tree module is used to extract items of interest. If the autobrief option is enabled, docstrings are parsed via a set of regular expressions and a producer / consumer pair of coroutines.Example
This filter will correctly process code like the following working (albeit contrived) example:def myfunction(arg1, arg2, kwarg='whatever.'):
"""
Does nothing more than demonstrate syntax.
This is an example of how a Pythonic human-readable docstring can
get parsed by doxypypy and marked up with Doxygen commands as a
regular input filter to Doxygen.
Args:
arg1: A positional argument.
arg2: Another positional argument.
Kwargs:
kwarg: A keyword argument.
Returns:
A string holding the result.
Raises:
ZeroDivisionError, AssertionError, & ValueError.
Examples:
>>> myfunction(2, 3)
'5 - 0, whatever.'
>>> myfunction(5, 0, 'oops.')
Traceback (most recent call last):
...
ZeroDivisionError: integer division or modulo by zero
>>> myfunction(4, 1, 'got it.')
'5 - 4, got it.'
>>> myfunction(23.5, 23, 'oh well.')
Traceback (most recent call last):
...
AssertionError
>>> myfunction(5, 50, 'too big.')
Traceback (most recent call last):
...
ValueError
"""
assert isinstance(arg1, int)
if arg2 > 23:
raise ValueError
return '{0} - {1}, {2}'.format(arg1 + arg2, arg1 / arg2, kwarg)
1. No special tags are used. Best practice human-readable section headers are enough.
2. Some flexibility is allowed. Most common names for sections are accepted, and items and descriptions may be separated by either colons or dashes.
- The brief must be the first item and be no longer than one line.
Additional more comprehensive examples can be found in the test area.
Installing doxypypy
One can use eitherpip
or easy_install
for installation.
Running either:pip install doxypypy
easy_install doxypypy
Previewing doxypypy Output
After successful installation, doxypypy can be run from the command line to preview the filtered results with:doxypypy -a -c file.py
doxypypy -a -c file.py > file.py.out
Invoking doxypypy from Doxygen
To make Doxygen run your Python code through doxypypy, set the FILTER_PATTERNS tag in your Doxyfile as follows:FILTER_PATTERNS = *.py=py_filter
For Unix-like operating systems, py_filter should like something like this:
#!/bin/bash
doxypypy -a -c $1
doxypypy -a -c %1
from https://github.com/Feneric/doxypypy
- cmake
- doxygen
- Windows或是Linux都可以,只要你有裝doxygen和cmake
configure_file指令最主要的作用就是把目標檔案的特定內容,做修改/替換,然後輸出成另一個檔案
在這個專案中,已事前使用 doxygen -g Doxyfile.in
產生了設定檔
然後針對該檔,只保留想要的內容,並且帶入想要被替換的部分
想要被替換的內容包含 @CMAKE_CURRENT_SOURCE_DIR@
和 @CMAKE_CURRENT_BINARY_DIR@
專案建置完後,你可以比較看看 Doxyfile.in
和 build/Doxyfile
這兩檔案的差別
Doxygen的設定檔所使用的設定檔,預設名稱為Doxyfile
在此專案中,cmake會透過configure_file指令,讀取設定檔模板 Doxyfile.in
取代掉 INPUT 與 OUTPUT_DIRECTORY 的值之後,輸出為 Doxyfile
之後呼叫 Doxygen
產生說明文件
此專案中最基礎的設定值有兩個,分別為 INPUT 和 OUTPUT_DIRECTORY ,對應輸入和輸出
mkdir build
cd build
cmake ..
cmake --build . # 等同於執行make,或是Visual Studio的建置按鈕
# 執行完會產生 doc_doxygen 資料夾,輸出的說明文件都會在裡面
# 找到 ./html/index.html ,用瀏覽器打開它就是了
from https://github.com/bdvstg/HowTo_Doxygen_with_CMake