diff options
-rw-r--r-- | doc/doc.pri | 4 | ||||
-rw-r--r-- | doc/doc_targets.pri | 81 | ||||
-rw-r--r-- | docs.pri | 56 |
3 files changed, 93 insertions, 48 deletions
diff --git a/doc/doc.pri b/doc/doc.pri index 1364a1a538..67a3032bfb 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -1,7 +1,7 @@ build_online_docs: \ - QTC_DOCS = $$PWD/qtcreator-online.qdocconf $$PWD/api/qtcreator-dev-online.qdocconf + DOC_FILES += $$PWD/qtcreator-online.qdocconf $$PWD/api/qtcreator-dev-online.qdocconf else: \ - QTC_DOCS = $$PWD/qtcreator.qdocconf $$PWD/api/qtcreator-dev.qdocconf + DOC_FILES += $$PWD/qtcreator.qdocconf $$PWD/api/qtcreator-dev.qdocconf include(../docs.pri) diff --git a/doc/doc_targets.pri b/doc/doc_targets.pri new file mode 100644 index 0000000000..16fbfa2b4e --- /dev/null +++ b/doc/doc_targets.pri @@ -0,0 +1,81 @@ +# Creates targets for building documentation +# (adapted from qt_docs.prf) +# +# Usage: Define variables (details below) and include this pri file afterwards. +# +# QDOC_ENV - environment variables to set for the qdoc call (see example below) +# DOC_INDEX_PATHS - list of paths where qdoc should search for index files of dependent +# modules (Qt index path is included by default) +# DOC_FILES - list of qdocconf files +# DOC_OUTDIR_POSTFIX - html is generated in $$OUT_PWD/<qdocconf_name>$$DOC_OUTDIR_POSTFIX +# DOC_HTML_INSTALLDIR - path were to install the directory of html files +# DOC_QCH_OUTDIR - path where to generated the qch files +# DOC_QCH_INSTALLDIR - path where to install the qch files +# +# Example for QDOC_ENV: +# ver.name = VERSION +# ver.value = 1.0.2 +# foo.name = FOO +# foo.value = foo +# QDOC_ENV = ver foo + +isEmpty(DOC_FILES): error("Set DOC_FILES before including doc_targets.pri") +isEmpty(DOC_HTML_INSTALLDIR): error("Set DOC_HTML_INSTALLDIR before including doc_targets.pri") +isEmpty(DOC_QCH_OUTDIR): error("Set DOC_QCH_OUTDIR before including doc_targets.pri") +isEmpty(DOC_QCH_INSTALLDIR): error("Set DOC_QCH_INSTALLDIR before including doc_targets.pri") + +QT_TOOL_ENV = $$QDOC_ENV +qtPrepareTool(QDOC, qdoc) +QT_TOOL_ENV = + +!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator) + +DOCS_BASE_OUTDIR = $$OUT_PWD/doc +DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS]) +for (index_path, DOC_INDEX_PATHS): \ + DOC_INDEXES += -indexdir $$shell_quote($$index_path) + +for (doc_file, DOC_FILES) { + !exists($$doc_file): error("Cannot find documentation specification file $$doc_file") + DOC_TARGET = $$replace(doc_file, ^(.*/)?(.*)\\.qdocconf$, \\2) + DOC_TARGETDIR = $$DOC_TARGET + DOC_OUTPUTDIR = $${DOCS_BASE_OUTDIR}/$${DOC_TARGETDIR}$${DOC_OUTDIR_POSTFIX} + + html_docs_$${DOC_TARGET}.commands = $$QDOC -outputdir $$shell_quote($$DOC_OUTPUTDIR) $$doc_file $$DOC_INDEXES + QMAKE_EXTRA_TARGETS += html_docs_$${DOC_TARGET} + + !isEmpty(html_docs.commands): html_docs.commands += && + html_docs.commands += $$eval(html_docs_$${DOC_TARGET}.commands) + + inst_html_docs.files += $$DOC_OUTPUTDIR + + !build_online_docs { + qch_docs_$${DOC_TARGET}.commands = $$QHELPGENERATOR $$shell_quote($$DOC_OUTPUTDIR/$${DOC_TARGET}.qhp) -o $$shell_quote($$DOC_QCH_OUTDIR/$${DOC_TARGET}.qch) + qch_docs_$${DOC_TARGET}.depends = html_docs_$${DOC_TARGET} + QMAKE_EXTRA_TARGETS += qch_docs_$${DOC_TARGET} + + !isEmpty(qch_docs.commands): qch_docs.commands += && + qch_docs.commands += $$eval(qch_docs_$${DOC_TARGET}.commands) + + inst_qch_docs.files += $$DOC_QCH_OUTDIR/$${DOC_TARGET}.qch + } +} + +!build_online_docs { + qch_docs.depends = html_docs + inst_qch_docs.path = $$DOC_QCH_INSTALLDIR + inst_qch_docs.CONFIG += no_check_exist no_default_install no_build + install_docs.depends = install_inst_qch_docs + docs.depends = qch_docs + INSTALLS += inst_qch_docs + QMAKE_EXTRA_TARGETS += qch_docs install_docs +} else { + docs.depends = html_docs +} + +inst_html_docs.path = $$DOC_HTML_INSTALLDIR +inst_html_docs.CONFIG += no_check_exist no_default_install directory +INSTALLS += inst_html_docs +install_docs.depends += install_inst_html_docs + +QMAKE_EXTRA_TARGETS += html_docs docs @@ -1,4 +1,7 @@ -# adapted from qt_docs.prf +# Creates targets for building Qt Creator documentation +# +# Usage: Include qtcreator.pri and define DOC_FILES to point to a list of qdocconf files, +# then include this .pri file isEmpty(VERSION): error("Include qtcreator.pri before including docs.pri!") @@ -12,50 +15,11 @@ qdocindex.name = QDOC_INDEX_DIR qdocindex.value = $$[QT_INSTALL_DOCS] qtcdocsdir.name = QTC_DOCS_DIR qtcdocsdir.value = $$IDE_SOURCE_TREE/doc -QT_TOOL_ENV = qtcver qtcvertag qtdocs qdocindex qtcdocsdir -qtPrepareTool(QDOC, qdoc) -QT_TOOL_ENV = +QDOC_ENV += qtcver qtcvertag qtdocs qdocindex qtcdocsdir -!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator) +DOC_INDEX_PATHS += $$IDE_BUILD_TREE/doc +DOC_HTML_INSTALLDIR = $$INSTALL_DOC_PATH +DOC_QCH_OUTDIR = $$IDE_DOC_PATH +DOC_QCH_INSTALLDIR = $$INSTALL_DOC_PATH -QTC_DOCS_BASE_OUTDIR = $$OUT_PWD/doc -DOC_INDEXES = -indexdir $$shell_quote($$[QT_INSTALL_DOCS]) \ - -indexdir $$shell_quote($$IDE_BUILD_TREE/doc) - -for (qtc_doc, QTC_DOCS) { - !exists($$qtc_doc): error("Cannot find documentation specification file $$qtc_doc") - QTC_DOCS_TARGET = $$replace(qtc_doc, ^(.*/)?(.*)\\.qdocconf$, \\2) - QTC_DOCS_TARGETDIR = $$QTC_DOCS_TARGET - QTC_DOCS_OUTPUTDIR = $$QTC_DOCS_BASE_OUTDIR/$$QTC_DOCS_TARGETDIR - - html_docs_$${QTC_DOCS_TARGET}.commands = $$QDOC -outputdir $$shell_quote($$QTC_DOCS_OUTPUTDIR) $$qtc_doc $$DOC_INDEXES - QMAKE_EXTRA_TARGETS += html_docs_$${QTC_DOCS_TARGET} - - !isEmpty(html_docs.commands): html_docs.commands += && - html_docs.commands += $$eval(html_docs_$${QTC_DOCS_TARGET}.commands) - - !build_online_docs { - qch_docs_$${QTC_DOCS_TARGET}.commands = $$QHELPGENERATOR $$shell_quote($$QTC_DOCS_OUTPUTDIR/$${QTC_DOCS_TARGET}.qhp) -o $$shell_quote($$IDE_DOC_PATH/$${QTC_DOCS_TARGET}.qch) - qch_docs_$${QTC_DOCS_TARGET}.depends = html_docs_$${QTC_DOCS_TARGET} - QMAKE_EXTRA_TARGETS += qch_docs_$${QTC_DOCS_TARGET} - - !isEmpty(qch_docs.commands): qch_docs.commands += && - qch_docs.commands += $$eval(qch_docs_$${QTC_DOCS_TARGET}.commands) - - inst_qch_docs.files += $$IDE_DOC_PATH/$${QTC_DOCS_TARGET}.qch - } -} - -!build_online_docs { - qch_docs.depends = html_docs - inst_qch_docs.path = $$INSTALL_DOC_PATH - inst_qch_docs.CONFIG += no_check_exist no_default_install no_build - install_docs.depends = install_inst_qch_docs - docs.depends = qch_docs - INSTALLS += inst_qch_docs - QMAKE_EXTRA_TARGETS += qch_docs install_docs -} else { - docs.depends = html_docs -} - -QMAKE_EXTRA_TARGETS += html_docs docs +include(doc/doc_targets.pri) |