File: SConscript

package info (click to toggle)
roc-toolkit 0.4.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,684 kB
  • sloc: cpp: 102,987; ansic: 8,959; python: 6,125; sh: 942; makefile: 16; javascript: 9
file content (81 lines) | stat: -rw-r--r-- 3,157 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Import('doc_env')

if 'doxygen' in COMMAND_LINE_TARGETS:
    if not GetOption('enable_doxygen'):
        doc_env.Die("'doxygen' target requires --enable-doxygen")

if 'sphinx' in COMMAND_LINE_TARGETS:
    if not GetOption('enable_sphinx'):
        doc_env.Die("'sphinx' target requires --enable-sphinx")

if 'docs' in COMMAND_LINE_TARGETS:
    if not GetOption('enable_doxygen') or not GetOption('enable_sphinx'):
        doc_env.Die("'doxygen' target requires --enable-doxygen and --enable-sphinx")

if GetOption('enable_doxygen'):
    doxygen_version = doc_env.ParseCompilerVersion(doc_env['DOXYGEN'])
    have_doxygen = doxygen_version and doxygen_version[:2] >= (1, 6)

    if not have_doxygen:
        doc_env.Die("doxygen >= 1.6 not found")

    doxygen_targets = [
        doc_env.Doxygen(
            html_dir='#docs/html/doxygen',
            build_dir='#build/docs/internal_modules',
            config='#src/internal_modules/Doxyfile',
            sources=(doc_env.GlobRecursive('#src/internal_modules', ['*.h', '*.dox']) +
                doc_env.GlobRecursive('#docs/images', ['*'])),
            werror=GetOption('enable_werror')),
        doc_env.Doxygen(
            build_dir='#build/docs/public_api',
            config='#src/public_api/Doxyfile',
            sources=doc_env.GlobRecursive('#src/public_api/include', ['*.h', '*.dox']),
            werror=GetOption('enable_werror')),
    ]

    doc_env.AlwaysBuild(
        doc_env.Alias('doxygen', doxygen_targets))

if GetOption('enable_sphinx'):
    if not GetOption('enable_sphinx'):
        doc_env.Die("--enable-sphinx also requires --enable-doxygen")

    have_sphinx = (doc_env.HasArgument('SPHINX_BUILD') or
                   doc_env.Which(doc_env['SPHINX_BUILD']))
    have_breathe = (doc_env.HasArgument('BREATHE_APIDOC') or
                    doc_env.Which(doc_env['BREATHE_APIDOC']))

    if not have_sphinx:
        doc_env.Die("sphinx-build not found")

    if not have_breathe:
        doc_env.Die("breathe-apidoc not found")

    sphinx_targets = [
        doc_env.Sphinx(
            build_dir='#build/docs/sphinx.html',
            output_type='html',
            output_dir='#docs/html/docs',
            source_dir='#docs/sphinx',
            sources=(doc_env.GlobRecursive('#docs/sphinx', ['*']) +
                doc_env.GlobRecursive('#docs/images', ['*']) +
                doc_env.GlobRecursive('#src/public_api/include', ['*.h', '*.dox']) +
                doxygen_targets),
            werror=GetOption('enable_werror')),
        doc_env.Sphinx(
            build_dir='#build/docs/sphinx.man',
            output_type='man',
            output_dir='#docs/man',
            source_dir='#docs/sphinx',
            sources=doc_env.GlobRecursive('#docs/sphinx', ['*']),
            werror=GetOption('enable_werror')),
    ]

    doc_env.AlwaysBuild(doc_env.Alias('sphinx', sphinx_targets))

doc_env.AlwaysBuild(doc_env.Alias('docs', ['doxygen', 'sphinx']))

for manpage in doc_env.GlobFiles('#docs/sphinx/manuals/*.rst'):
    doc_env.AddDistFile(GetOption('mandir'), '#docs/man/{}.1'.format(
        manpage.srcnode().name.replace('.rst', '').replace('_', '-')))