aboutsummaryrefslogtreecommitdiff
path: root/subprojects/d2tk/pugl/doc/c/wscript
blob: 4e0fbc92f71d1791daf0dd04b74cd971e4187855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python

def build(bld):
    dox_to_sphinx = bld.path.find_node("../../scripts/dox_to_sphinx.py")
    index_xml = bld.path.get_bld().make_node("xml/index.xml")

    files = [
        ("../../resources/pugl.svg", "sphinx/_static/pugl.svg"),
        ("../_static/custom.css", "sphinx/_static/custom.css"),
        ("../_templates/about.html", "sphinx/_templates/about.html"),
        ("../deployment.rst", "sphinx/deployment.rst"),
        ("../pugl.rst", "sphinx/pugl.rst"),
        ("index.rst", "sphinx/index.rst"),
        ("overview.rst", "sphinx/overview.rst"),
        ("reference.rst", "sphinx/reference.rst"),
    ]

    # Run Doxygen to generate XML documentation
    bld(features="doxygen", doxyfile="Doxyfile")

    # Substitute variables to make Sphinx configuration file
    bld(features="subst",
        source="../conf.py.in",
        target="sphinx/conf.py",
        PUGL_VERSION=bld.env.PUGL_VERSION)

    # Copy static documentation files to Sphinx build directory
    for f in files:
        bld(features="subst", is_copy=True, source=f[0], target=f[1])

    # Generate Sphinx markup from Doxygen XML
    bld.add_group()
    bld(rule="${PYTHON} " + dox_to_sphinx.abspath() + " -f ${SRC} ${TGT}",
        source=index_xml,
        target="sphinx/api/")

    # Run Sphinx to generate HTML documentation
    doc_dir = bld.env.DOCDIR + "/pugl-%s/" % bld.env.PUGL_MAJOR_VERSION
    bld(features="sphinx",
        sphinx_source=bld.path.get_bld().make_node("sphinx"),
        sphinx_output_format="singlehtml",
        sphinx_options=["-E", "-q"],
        install_path=doc_dir + "c/singlehtml/")