centralize doc target related code
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>
Fri, 30 Nov 2012 20:07:47 +0000 (21:07 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sun, 2 Dec 2012 01:16:08 +0000 (02:16 +0100)
Change-Id: I710a7f2fc3422ec8ba5b8e90bfd92e7931092ad0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
mkspecs/features/default_pre.prf
mkspecs/features/qt_docs.prf [new file with mode: 0644]
mkspecs/features/qt_docs_targets.prf
mkspecs/features/qt_installs.prf
mkspecs/features/qt_module.prf

index 8f8916a..0dd82ee 100644 (file)
@@ -1,7 +1,2 @@
 load(exclusive_builds)
 CONFIG = lex yacc warn_on debug exceptions depend_includepath $$CONFIG
-
-# Populate the installdir which will be passed to qdoc in the default_post.prf
-# This allows a project to remove the installdir if need be, to trigger building online docs,
-# which Qt Creator does.
-QMAKE_DOCS_INSTALLDIR = $$[QT_INSTALL_DOCS]
diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
new file mode 100644 (file)
index 0000000..3eb138b
--- /dev/null
@@ -0,0 +1,45 @@
+!exists($$QMAKE_DOCS): error("Cannot find documentation specification file $$QMAKE_DOCS")
+
+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
+
+qtPrepareTool(QDOC, qdoc)
+for(qmod, QMAKEMODULES): \
+    QDOC += -indexdir $$section(qmod, /, 0, -3)/doc
+QDOC += -outputdir $$QMAKE_DOCS_OUTPUTDIR
+!build_online_docs: \
+    QDOC += -installdir $$[QT_INSTALL_DOCS]
+doc_command = $$QDOC $$QMAKE_DOCS
+prepare_docs {
+    prepare_docs.commands += $$doc_command -prepare -no-link-errors
+    generate_docs.commands += $$doc_command -generate
+    html_docs.depends += generate_docs
+} else {
+    html_docs.commands += $$doc_command
+}
+
+!build_online_docs {
+    qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
+    qch_docs.commands = $$QHELPGENERATOR $$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp -o $$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
+    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
+    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
+}
index 69eefe9..0d9f90b 100644 (file)
     } else {
         # apps and libs only generate docs if QMAKE_DOCS is set
         !isEmpty(QMAKE_DOCS) {
-            !exists($$QMAKE_DOCS):error("Cannot find documentation specification file $$QMAKE_DOCS")
-            qtPrepareTool(QDOC, qdoc)
-            for(index, QMAKE_DOCS_INDEX):QDOC_INDEX += -indexdir $$index
-            !isEmpty(QMAKE_DOCS_OUTPUTDIR):QMAKE_DOCS_OPTIONS += -outputdir $$QMAKE_DOCS_OUTPUTDIR
-            !isEmpty(QMAKE_DOCS_INSTALLDIR):QMAKE_DOCS_OPTIONS += -installdir $$QMAKE_DOCS_INSTALLDIR
-            doc_command = $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS
-            prepare_docs {
-                prepare_docs.commands += $$doc_command -prepare -no-link-errors
-                generate_docs.commands += $$doc_command -generate
-                html_docs.depends += generate_docs
-            } else {
-                html_docs.commands += $$doc_command
-            }
-
-            qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
-            isEmpty(QMAKE_DOCS_TARGET): QMAKE_DOCS_TARGET = $$basename(QMAKE_DOCS_OUTPUTDIR)
-            qch_docs.commands = $$QHELPGENERATOR $$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp -o $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+            # backwards compat hack
+            load(qt_docs)
         }
     }
     docs.commands = $(MAKE) -f $(MAKEFILE) html_docs && $(MAKE) -f $(MAKEFILE) qch_docs
index bebf918..0e860cc 100644 (file)
@@ -37,22 +37,3 @@ qt_install_module {
         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
     }
 }
-
-qt_install_module_docs {
-    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
-    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
-    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
-}
index eeb8f7b..eb46481 100644 (file)
@@ -113,18 +113,7 @@ win32:!wince*:exists($$[QT_INSTALL_PREFIX]/.qmake.cache): DLLDESTDIR = $$eval(QT
 CONFIG          += qt warn_on depend_includepath
 CONFIG          += qmake_cache target_qt
 
-!isEmpty(QMAKE_DOCS) {
-    doc_subdir = doc
-
-    unset(QMAKE_DOCS_INDEX)
-    QMAKE_DOCS_BASE_OUTDIR = $$MODULE_BASE_OUTDIR/$$doc_subdir
-    QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/qt$${MODULE}
-    QMAKE_DOCS_TARGET = $$replace(QMAKE_DOCS, ^(.*/)?(.*)\\.qdocconf$, \\2)
-    for(qmod, QMAKEMODULES): \
-        QMAKE_DOCS_INDEX += $$section(qmod, /, 0, -3)/$$doc_subdir
-
-    CONFIG += qt_install_module_docs
-}
+QMAKE_DOCS_TARGETDIR = qt$${MODULE}
 
 # If Qt was configured with -debug-and-release then build the module the same way
 # - unless this is a host library