summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2023-06-21 13:18:42 +0000
committerHeikki Halmet <heikki.halmet@qt.io>2023-08-17 07:11:34 +0000
commit21c2381304b7eb682cf38c7f96492bfed5631e3c (patch)
treedf13b3ce372941a04753aac084971206e780ed3e
parent835ccf1766bc77e4ef581e9e6ba699a43338ecf3 (diff)
Reintroduce custom documentation build targets
Documentation build targets have been removed from Qt 6 when building with qmake. Reintroduce custom targets to call qdoc, qhelpgenerator, and qtattributionsscanner via 'html_docs' and 'docs' targets. These are adapted from similar targets once used by Qt Creator. Change-Id: If572b709c56860a9949c1f4a5ae66a660e2a621e Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
-rw-r--r--.qmake.conf1
-rw-r--r--coin/instructions/make_win_docs_instructions.yaml2
-rw-r--r--doc/doc.pri40
-rw-r--r--doc/doc.pro12
-rw-r--r--doc/doc_targets.pri89
-rw-r--r--installerfw.pro3
6 files changed, 132 insertions, 15 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 57b97ccc9..0bdc8dcee 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,2 +1 @@
VERSION=4.7.0
-CONFIG=prepare_docs qt_docs_targets $$CONFIG
diff --git a/coin/instructions/make_win_docs_instructions.yaml b/coin/instructions/make_win_docs_instructions.yaml
index 5d5f28f67..ab281501a 100644
--- a/coin/instructions/make_win_docs_instructions.yaml
+++ b/coin/instructions/make_win_docs_instructions.yaml
@@ -3,7 +3,7 @@ instructions:
- type: Group
instructions:
- type: ChangeDirectory
- directory: "{{.SourceDir}}\\doc"
+ directory: "{{.SourceDir}}"
maxTimeInSeconds: 300
maxTimeBetweenOutput: 120
userMessageOnFailure: "Failed to change dir"
diff --git a/doc/doc.pri b/doc/doc.pri
new file mode 100644
index 000000000..5f17fa26c
--- /dev/null
+++ b/doc/doc.pri
@@ -0,0 +1,40 @@
+QT += core-private widgets concurrent network qml xml
+
+DOC_TARGETDIR = html
+INSTALL_DOC_PATH = $$IFW_BUILD_TREE/doc/$$DOC_TARGETDIR
+
+build_online_docs: \
+ DOC_FILES = $$PWD/ifw-online.qdocconf
+else: \
+ DOC_FILES = $$PWD/ifw.qdocconf
+
+qtdocs.name = QT_INSTALL_DOCS
+qtdocs.value = $$[QT_INSTALL_DOCS/src]
+qdocindex.name = QDOC_INDEX_DIR
+qdocindex.value = $$[QT_INSTALL_DOCS]
+qtver.name = QT_VERSION
+qtver.value = $$VERSION
+qtvertag.name = QT_VERSION_TAG
+qtvertag.value = $$replace(VERSION, \.,)
+QDOC_ENV += \
+ qtdocs \
+ qdocindex \
+ qtver \
+ qtvertag
+
+DOC_HTML_INSTALLDIR = $$INSTALL_DOC_PATH
+DOC_QCH_OUTDIR = $$IFW_BUILD_TREE/doc
+DOC_QCH_INSTALLDIR = $$INSTALL_DOC_PATH
+
+for (include_path, INCLUDEPATH): \
+ DOC_INCLUDES += -I $$shell_quote($$include_path)
+for (module, QT) {
+ MOD_INCLUDES = $$eval(QT.$${module}.includes)
+ for (include_path, MOD_INCLUDES): \
+ DOC_INCLUDES += -I $$shell_quote($$include_path)
+}
+for (include_path, QMAKE_DEFAULT_INCDIRS): \
+ DOC_INCLUDES += -I $$shell_quote($$include_path)
+macos: DOC_INCLUDES += -F $$shell_quote($$[QT_INSTALL_LIBS])
+
+include(doc_targets.pri)
diff --git a/doc/doc.pro b/doc/doc.pro
deleted file mode 100644
index b22f139f0..000000000
--- a/doc/doc.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = aux
-
-CONFIG += force_qt
-QT += core-private widgets concurrent network qml xml
-
-CONFIG += force_independent
-QMAKE_DOCS_TARGETDIR = html
-
-build_online_docs: \
- QMAKE_DOCS = $$PWD/ifw-online.qdocconf
-else: \
- QMAKE_DOCS = $$PWD/ifw.qdocconf
diff --git a/doc/doc_targets.pri b/doc/doc_targets.pri
new file mode 100644
index 000000000..274cf616a
--- /dev/null
+++ b/doc/doc_targets.pri
@@ -0,0 +1,89 @@
+# 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 to install the directory of html files
+# DOC_QCH_OUTDIR - path to generate the qch files
+# DOC_QCH_INSTALLDIR - path 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: qtPrepareLibExecTool(QHELPGENERATOR, qhelpgenerator)
+qtPrepareLibExecTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner)
+
+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)
+ isEmpty(DOC_TARGETDIR): 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 $$DOC_INCLUDES
+ 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
+ }
+}
+
+qtattributionsscanner.target = qtattributionsscanner
+qtattributionsscanner.commands = $$QTATTRIBUTIONSSCANNER $$shell_quote($$IFW_SOURCE_TREE) \
+ --filter "QDocModule=ifw" -o $$shell_quote($$OUT_PWD/doc/codeattributions.qdoc)
+qtattributionsscanner.CONFIG += phony
+QMAKE_EXTRA_TARGETS += qtattributionsscanner
+html_docs.depends = qtattributionsscanner
+
+!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
diff --git a/installerfw.pro b/installerfw.pro
index ee9e5b1cc..f8f2b5469 100644
--- a/installerfw.pro
+++ b/installerfw.pro
@@ -1,10 +1,11 @@
TEMPLATE = subdirs
-SUBDIRS += src tools doc
+SUBDIRS += src tools
tools.depends = src
requires(!cross_compile)
include (installerfw.pri)
+include (doc/doc.pri)
BUILD_TESTS = $$(BUILDTESTS)
isEmpty(BUILD_TESTS):BUILD_TESTS=$${BUILDTESTS}