summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt_docs.prf
blob: 3414941579d33c9523796b4c1e9ce867c381fa59 (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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
#  W A R N I N G
#  -------------
#
# This file is not part of the Qt API.  It exists purely as an
# implementation detail.  It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#

!exists($$QMAKE_DOCS): error("Cannot find documentation specification file $$QMAKE_DOCS")

qtver.name = QT_VERSION
qtver.value = $$VERSION
isEmpty(qtver.value): qtver.value = $$MODULE_VERSION
isEmpty(qtver.value): error("No version for documentation specified.")
qtmver.name = QT_VER
qtmver.value = $$replace(qtver.value, ^(\\d+\\.\\d+).*$, \\1)
qtvertag.name = QT_VERSION_TAG
qtvertag.value = $$replace(qtver.value, \\.,)
qtdocs.name = QT_INSTALL_DOCS
qtdocs.value = $$[QT_INSTALL_DOCS/src]
builddir.name = BUILDDIR
builddir.value = $$OUT_PWD
QT_TOOL_ENV = qtver qtmver qtvertag qtdocs builddir
qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV =

# On Windows, put the includes into a .inc file which QDoc will read, if the project
# has too many includes. We do this to overcome a command-line limit on Windows.
WIN_INCLUDETEMP=
INCLUDE_PATHS=$$INCPATH
win32:count(INCLUDE_PATHS, 30, >) {
    WIN_INCLUDETEMP = $$OUT_PWD/qdocincludepaths.inc
    WIN_INCLUDETEMP_CONTENT =
    for (inc, INCLUDE_PATHS): \
        WIN_INCLUDETEMP_CONTENT += -I$$inc
    write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONTENT)|error()
}

isEmpty(WIN_INCLUDETEMP) {
    QDOC_INCLUDE_PATHS=$(INCPATH)
} else {
    QDOC_INCLUDE_PATHS=@$$shell_quote($$WIN_INCLUDETEMP)
}

macos: QDOC_INCLUDE_PATHS += $$join(QMAKE_DEFAULT_INCDIRS," -I","-I")

!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator)

qtPrepareLibExecTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner)

# qtPrepareTool() must be called outside a build pass, as it protects
# against concurrent wrapper creation by omitting it during build passes.
# However, creating the actual targets is reserved to the build passes.
debug_and_release:!build_pass: return()

load(qt_build_paths)
QMAKE_DOCS_BASE_OUTDIR = $$MODULE_BASE_OUTDIR/doc

QMAKE_DOCS_TARGET = $$replace(QMAKE_DOCS, ^(.*/)?(.*)\\.qdocconf$, \\2)
isEmpty(QMAKE_DOCS_TARGETDIR): QMAKE_DOCS_TARGETDIR = $$QMAKE_DOCS_TARGET
QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR

QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
!build_online_docs: \
    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
PREP_DOC_INDEXES =
DOC_INDEXES =
!isEmpty(QTREPOS) {
    prepare_docs {
        # This is not for linking, but for providing type information.
        mps =
        deps = $$replace(QT, -private$, )
        deps = $$resolve_depends(deps, "QT.")
        for (d, deps): \
            mps += $$dirname(QT.$${d}.libs)
        mps = $$unique(mps)
        for (mp, mps): \
            PREP_DOC_INDEXES += -indexdir $$shell_quote($$mp/doc)
    }
    for(qrep, QTREPOS): \
        DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
} else {
    prepare_docs: \
        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
}

qtattributionsscanner.target = qtattributionsscanner
qtattributionsscanner.commands = $$QTATTRIBUTIONSSCANNER $$shell_quote($$MODULE_BASE_INDIR) \
    --filter "QDocModule=$$QMAKE_DOCS_TARGET" -o $$shell_quote($$OUT_PWD/codeattributions.qdoc)
qtattributionsscanner.CONFIG += phony
QMAKE_EXTRA_TARGETS += qtattributionsscanner

doc_command = $$QDOC $$QMAKE_DOCS
prepare_docs {
    prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors $$QDOC_INCLUDE_PATHS
    generate_docs.commands += $$doc_command -generate $$DOC_INDEXES $$QDOC_INCLUDE_PATHS
    prepare_docs.depends += qtattributionsscanner
} else {
    html_docs.commands += $$doc_command $$DOC_INDEXES $(QDOC_INCLUDE_PATHS)
    html_docs.depends += qtattributionsscanner
}

!build_online_docs {
    qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)

    inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
    inst_html_docs.path = $$[QT_INSTALL_DOCS]
    inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
    INSTALLS += inst_html_docs

    inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
    inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
    INSTALLS += inst_qch_docs

    install_html_docs.depends = install_inst_html_docs
    uninstall_html_docs.depends = uninstall_inst_html_docs
    install_qch_docs.depends = install_inst_qch_docs
    uninstall_qch_docs.depends = uninstall_inst_qch_docs
    install_docs.depends = install_html_docs install_qch_docs
    uninstall_docs.depends = uninstall_html_docs uninstall_qch_docs
}