SCons tool to generate Doxyfile for Doxygen. The generated Doxyfile may be further used by scons_doxygen tool.
Create new git repository:
mkdir /tmp/prj && cd /tmp/prj touch README.rst git init
Add scons_doxygen as submodule (here we use git mirror of scons_doxygen):
git submodule add git://github.com/ptomulik/scons_doxygen.git site_scons/site_tools/doxygen
Add scons-tool-doxyfile as submodule:
git submodule add git://github.com/ptomulik/scons-tool-doxyfile.git site_scons/site_tools/doxyfile
Copy doxygen template to
src/
:mkdir src && cp site_scons/site_tools/doxyfile/Doxyfile.in src/
Create some source files, for example
src/test.hpp
:// src/test.hpp /** * @brief Test class */ class TestClass { };
Write
SConstruct
file:# SConstruct env = Environment(tools = [ 'doxyfile', 'doxygen']) SConscript('src/SConscript', exports=['env'], variant_dir='build', duplicate=0)
Write
src/SConscript
:# src/SConscript Import(['env']) doxyfile = env.Doxyfile( INPUT = '.', RECURSIVE = True) env.Doxygen(doxyfile)
Try it out:
scons
This shall create documentation under
build
directory.Check the generated documentation (it should contain docs for
TestClass
underClasses
tab):firefox build/html/index.html
The scons-tool-doxyfile consists of five files:
__init__.py
anddoxyoptions.py
files,Doxyfile.in
template.SConstruct
script, and- this
README.rst
The tool provides a Doxyfile()
builder which generates Doxyfile
configuration file from Doxyfile.in
template. It accepts several options
to customize the generated Doxyfile
. The options are passed as keyword
arguments to Doxyfile
:
env.Doxyfile(INPUT = '.', RECURSIVE = True, STRIP_FROM_INC_PATH = '.', ...)
Same template may be used to generate documentation for several sub-projects by
using different sets of options (and variant builds, if necessary).
You may also use your own template file, instead of default Doxyfile.in
shipped along with this tool.
The options Doxyfile()
builder accepts are categorized into several types:
Type | Note | Example value in SConscript | Example output to Doxyfile |
---|---|---|---|
int | integer | 3 | 3 |
str | string | 'str1' or 'str 2' | str1 or "str 2" |
list | list | ['a b', False, 3] | "a b" False 3 |
dict | dictionary | {'a' : 'A', 'b' : 'B'} | a=A b=B |
bool | boolean | True or False | YES or NO |
entry | ref to file or directory | 'foo' | /tmp/prj/build/foo |
file | ref to file | 'bar.txt' | /tmp/prj/build/bar.txt |
dir | ref to directory | '.' | /tmp/prj/build |
srcentry | ref to source file or dir | 'foo' | /tmp/prj/src/foo |
srcfile | ref to source file | 'foo.txt' | /tmp/prj/src/foo.txt |
srcdir | ref to source directory | '.' | /tmp/prj/src |
dualentry | ref to entry + its source | 'foo' | /tmp/prj/build/foo \
/tmp/prj/src/foo
|
dualfile | ref to file + its source | 'foo.txt' | /tmp/prj/build/foo.txt \
/tmp/prj/src/foo.txt
|
dualdir | ref to dir + its source | '.' | /tmp/prj/build \
/tmp/prj/src
|
entries | list of entries | ['foo', 'bar/gez'] | /tmp/prj/build/foo \
/tmp/prj/build/bar/geez
|
files | list of files | ['foo', 'bar.txt'] | /tmp/prj/build/foo \
/tmp/prj/build/bar.txt
|
dirs | list of directories | ['.', 'foo'] | /tmp/prj/build \
/tmp/prj/build/foo
|
srcentries | list of source entries | ['.', 'foo'] | /tmp/prj/src \
/tmp/prj/src/foo
|
srcfiles | list of source files | ['a.txt', 'b.txt'] | /tmp/prj/src/a.txt \
/tmp/prj/src/b.txt
|
srcdirs | list of source dirs | ['.', 'foo'] | /tmp/prj/src \
/tmp/prj/src/foo
|
dualentries | list of dual entries | ['.', 'foo'] | /tmp/prj/build \
/tmp/prj/src \
/tmp/prj/build/foo \
/tmp/prj/src/foo
|
dualfiles | list of dual files | ['a.txt', 'b.txt'] | /tmp/prj/build/a.txt \
/tmp/prj/src/a.txt \
/tmp/prj/build/b.txt \
/tmp/prj/src/b.txt
|
dualdirs | list of dual directories | ['.', 'foo'] | /tmp/prj/build \
/tmp/prj/src \
/tmp/prj/build/foo \
/tmp/prj/src/foo
|
An entry is a path to file or directory (undecided). For each value of type
entry, file or dir a single path is outputted to Doxyfile. If
relative paths are provided by user, they are assumed to be relative to a
directory containing the calling SConscript
. Note, that SCons
will
write absolute paths to Doxyfile, so you should consider using
STRIP_FROM_PATH
, STRIP_FROM_INC_PATH
and similar options.
In variant builds, the entry, file and directory, if given as relative paths, will point to a file or subdirectory of build dir.
A srcentry, srcfile, or srcdir will generate a path pointing to a source file or directory corresponding to given file. This, of course, becomes relevant when variant builds are used.
Dual entry, file (or directory) results with a single path or two paths being emitted to Doxyfile. For variant builds, pair of paths is written to Doxyfile: the first one in build dir and the second pointing to a corresponding source file or dir.
The values written to Doxyfile are automatically quoted if they contain
white spaces. For example, the hash {'a' : 'be ce'}
will result with
a="be ce"
.
Values being assigned to Doxyfile options are subject of simple validation.
The supported options are summarized in the following table:
If you change some options in doxyoptions.py
, then you should regenerate
option's documentation in README.rst
. New documentation may be generated by
running:
scons -Q doc-options
After that, copy-paste the output of the above command to an appropriate place
in this README.rst
(note, just skip scons messages).
Copyright (c) 2013 by Pawel Tomulik <ptomulik@meil.pw.edu.pl>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE